Skip to content

Commit

Permalink
Merge pull request #53 from Achiefs/52-bump-0.3.1
Browse files Browse the repository at this point in the history
Bump and release 0.3.1
  • Loading branch information
okynos authored Jun 3, 2022
2 parents 71609c2 + 4e3f450 commit b4446d1
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fim"
version = "0.3.0"
version = "0.3.1"
authors = ["José Fernández <´[email protected]´>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion pkg/deb/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -ex

brand="fim"
target_dir=$(pwd)
architecture="amd64"
if [ $(uname -i) = "x86_64" ]; then architecture="amd64"; elif [ $(uname -i) = "aarch64" ]; then architecture="arm64"; fi
base_dir="${target_dir}/../../"
version="$(grep -m1 'version' ${base_dir}/Cargo.toml | cut -d' ' -f3 | tr -d '"')"
release="1"
Expand Down
6 changes: 6 additions & 0 deletions pkg/deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
fim (0.3.1-1) bionic; urgency=medium

* More info: https://github.com/Achiefs/fim/releases/tag/v0.3.1

-- Jose Fernandez <[email protected]> Wed, 01 Jun 2022 20:23:00 +0000

fim (0.3.0-1) bionic; urgency=medium

* More info: https://github.com/Achiefs/fim/releases/tag/v0.3.0
Expand Down
3 changes: 3 additions & 0 deletions pkg/deb/repository/release/fim_0.3.1-1_amd64.deb
Git LFS file not shown
3 changes: 3 additions & 0 deletions pkg/deb/repository/release/fim_0.3.1-1_arm64.deb
Git LFS file not shown
3 changes: 3 additions & 0 deletions pkg/deb/repository/test/fim_0.3.1-1_amd64.deb
Git LFS file not shown
3 changes: 3 additions & 0 deletions pkg/deb/repository/test/fim_0.3.1-1_arm64.deb
Git LFS file not shown
2 changes: 1 addition & 1 deletion pkg/fim.1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.\" *
.\" **************************************************************************
.\"
.TH fim 1 "28 Mar 2022" "FIM 0.3.0" "FIM Manual"
.TH fim 1 "01 Jun 2022" "FIM 0.3.1" "FIM Manual"

.SH NAME
.B FIM
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpm/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -ex

brand="fim"
current_dir=$(pwd)
architecture="x86_64"
architecture=$(uname -i)
rpmbuild="/usr/bin/rpmbuild"
version="$(grep -m1 'version' ../../Cargo.toml | cut -d' ' -f3 | tr -d '"')"
bin_path="/usr/bin"
Expand Down
3 changes: 3 additions & 0 deletions pkg/rpm/fim.spec
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ rm -fr %{buildroot}
# -----------------------------------------------------------------------------

%changelog
* Wed Jun 01 2022 support <[email protected]> - 0.3.1
- More info: https://github.com/Achiefs/fim/releases/tag/v0.3.1

* Wed May 18 2022 support <[email protected]> - 0.3.0
- More info: https://github.com/Achiefs/fim/releases/tag/v0.3.0

Expand Down
3 changes: 3 additions & 0 deletions pkg/rpm/repository/release/fim-0.3.1-1.aarch64.rpm
Git LFS file not shown
3 changes: 3 additions & 0 deletions pkg/rpm/repository/release/fim-0.3.1-1.x86_64.rpm
Git LFS file not shown
3 changes: 3 additions & 0 deletions pkg/rpm/repository/test/fim-0.3.1-1.aarch64.rpm
Git LFS file not shown
3 changes: 3 additions & 0 deletions pkg/rpm/repository/test/fim-0.3.1-1.x86_64.rpm
Git LFS file not shown
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2021, Achiefs.

// Global constants definitions
pub const VERSION: &str = "0.3.0";
pub const VERSION: &str = "0.3.1";
pub const NETWORK_MODE: &str = "NETWORK";
pub const FILE_MODE: &str = "FILE";
pub const BOTH_MODE: &str = "BOTH";
Expand Down
45 changes: 33 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,31 @@ fn setup_logger(config: config::Config){

// ----------------------------------------------------------------------------

async fn create_index(destination: &str, index_name: String, config: config::Config){
fn setup_events(destination: &str, config: config::Config){
// Perform actions depending on destination
info!("Events destination selected: {}", destination);
match destination {
config::BOTH_MODE => {
println!("[INFO] Events file: {}", config.events_file);
fs::create_dir_all(Path::new(&config.events_file).parent().unwrap().to_str().unwrap()).unwrap();

// On start create index (Include check if events won't be ingested by http)
index::create_index( index_name, config.endpoint_address, config.endpoint_user, config.endpoint_pass, config.insecure).await;
},
config::NETWORK_MODE => {
debug!("Events folder not created in network mode");
},
_ => {
info!("Events file: {}", config.events_file);
fs::create_dir_all(Path::new(&config.events_file).parent().unwrap().to_str().unwrap()).unwrap()
}
}
}

// ----------------------------------------------------------------------------

async fn create_index(destination: &str, index_name: String, config: config::Config){
// Perform actions depending on destination
match destination {
config::NETWORK_MODE|config::BOTH_MODE => {
// On start create index (Include check if events won't be ingested by http)
index::create_index( index_name, config.endpoint_address, config.endpoint_user, config.endpoint_pass, config.insecure).await;
},
_ => {
println!("[INFO] Events file: {}", config.events_file);
fs::create_dir_all(Path::new(&config.events_file).parent().unwrap().to_str().unwrap()).unwrap()
debug!("Index not created in file mode");
}
}
}
Expand Down Expand Up @@ -102,9 +110,11 @@ async fn main() {
println!("[INFO] Log level: {}", config.log_level);

setup_logger(config.clone());

let destination = config.get_events_destination();
let mut create_index_date = OffsetDateTime::now_utc().replace_day(OffsetDateTime::now_utc().day()-1).unwrap();
setup_events(destination.as_str(), config.clone());

let day = if OffsetDateTime::now_utc().day()-1 == 0 { 2 }else{ OffsetDateTime::now_utc().day()-1 };
let mut create_index_date = OffsetDateTime::now_utc().replace_day(day).unwrap();

// Iterating over monitor paths and set watcher on each folder to watch.
let (tx, rx) = channel();
Expand Down Expand Up @@ -220,6 +230,17 @@ mod tests {
let config = config::Config::new(env::consts::OS);
fs::create_dir_all(Path::new(&config.log_file).parent().unwrap().to_str().unwrap()).unwrap();
block_on(create_index("file", String::from("fim"), config.clone()));
block_on(create_index("network", String::from("fim"), config.clone()));
}

// ------------------------------------------------------------------------

#[test]
fn test_setup_events() {
let config = config::Config::new(env::consts::OS);
fs::create_dir_all(Path::new(&config.log_file).parent().unwrap().to_str().unwrap()).unwrap();
setup_events("file", config.clone());
setup_events("network", config.clone());
}

// ------------------------------------------------------------------------
Expand Down

0 comments on commit b4446d1

Please sign in to comment.