0.2.14 only try to merge files, filter nested directories

This commit is contained in:
mbecker20
2023-04-01 19:35:04 +00:00
parent b375708bbd
commit 4aac301852
11 changed files with 40 additions and 35 deletions

38
Cargo.lock generated
View File

@@ -804,7 +804,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"async_timing_util",
@@ -824,7 +824,7 @@ dependencies = [
"jwt",
"merge_config_files",
"monitor_helpers",
"monitor_types 0.2.13",
"monitor_types 0.2.14",
"mungos",
"periphery_client",
"serde",
@@ -1058,10 +1058,10 @@ checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
[[package]]
name = "db_client"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"monitor_types 0.2.13",
"monitor_types 0.2.14",
"mungos",
]
@@ -1835,9 +1835,9 @@ dependencies = [
[[package]]
name = "merge_config_files"
version = "0.1.2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eb90e0f8c47b81cd4bb84865e595ac3b0c5fabe6bf73bbd0507162b2fcc3c8a"
checksum = "48ed7c516ae04f732a7651e6bbbbdfd7762170fca6b6d263c14a105c41cab9a5"
dependencies = [
"serde",
"serde_json",
@@ -1934,12 +1934,12 @@ dependencies = [
[[package]]
name = "monitor_cli"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"async_timing_util",
"clap",
"colored",
"monitor_types 0.2.13",
"monitor_types 0.2.14",
"rand",
"run_command",
"serde",
@@ -1951,12 +1951,12 @@ dependencies = [
[[package]]
name = "monitor_client"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"envy",
"futures-util",
"monitor_types 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest",
"serde",
"serde_derive",
@@ -1968,11 +1968,11 @@ dependencies = [
[[package]]
name = "monitor_helpers"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"axum",
"monitor_types 0.2.13",
"monitor_types 0.2.14",
"rand",
"serde",
"serde_json",
@@ -1981,7 +1981,7 @@ dependencies = [
[[package]]
name = "monitor_periphery"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"async_timing_util",
@@ -1994,7 +1994,7 @@ dependencies = [
"futures",
"merge_config_files",
"monitor_helpers",
"monitor_types 0.2.13",
"monitor_types 0.2.14",
"run_command",
"serde",
"serde_derive",
@@ -2008,7 +2008,7 @@ dependencies = [
[[package]]
name = "monitor_types"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"bollard",
@@ -2025,9 +2025,9 @@ dependencies = [
[[package]]
name = "monitor_types"
version = "0.2.13"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16dc62e1626477f66340013650aebcd152ee14880b767f76359fbce2b0d621ed"
checksum = "19f0b594fa8c0af0c9d4ad7962a15782c7aa4afa575c60df69341f2de012e0c5"
dependencies = [
"anyhow",
"bollard",
@@ -2268,11 +2268,11 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "periphery_client"
version = "0.2.13"
version = "0.2.14"
dependencies = [
"anyhow",
"futures-util",
"monitor_types 0.2.13",
"monitor_types 0.2.14",
"reqwest",
"serde",
"serde_json",

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_cli"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
authors = ["MoghTech"]
description = "monitor cli | tools to setup monitor system"

View File

@@ -1,6 +1,6 @@
[package]
name = "core"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -37,4 +37,4 @@ typeshare = "1.0.0"
hex = "0.4"
aws-config = "0.55"
aws-sdk-ec2 = "0.25"
merge_config_files = "0.1.1"
merge_config_files = "0.1.3"

View File

@@ -13,7 +13,7 @@ The easiest way to do this is to follow the [monitor guide](https://github.com/m
1. Download the periphery binary from the latest [release](https://github.com/mbecker20/monitor/releases).
2. Create and edit your config files, following the [config example](https://github.com/mbecker20/monitor/blob/main/config_example/periphery.config.example.toml). The monitor cli can be used to add the boilerplate: ```monitor periphery gen-config --path /path/to/config.toml```. The files can be anywhere, and can be passed to periphery via the ```--config-path``` flag.
2. Create and edit your config files, following the [config example](https://github.com/mbecker20/monitor/blob/main/config_example/periphery.config.example.toml). The monitor cli can be used to add the boilerplate: ```monitor periphery gen-config --path /path/to/config.toml```. The files can be anywhere, and can be passed to periphery via the ```--config-path``` argument.
3. Ensure that inbound connectivity is allowed on the port specified in periphery.config.toml (default 8000).
@@ -26,16 +26,22 @@ The easiest way to do this is to follow the [monitor guide](https://github.com/m
```
periphery \
--config-path /path/to/periphery.config.base.toml \
--config-path /other_path/to/periphery.config.overide.toml \
--config-path /other_path/to/overide-periphery-config-directory \
--config-keyword periphery \
--config-keyword config \
--merge-nested-config \
--home_dir /home/username
```
## passing config files
when you pass multiple config files, later --config-path given in the command will always overide previous ones.
Either file paths or directory paths can be passed to ```--config-path```.
there are two ways to merge config files. The default behavior is to completely replace any base fields with whatever fields are present in the overide config. So if you pass ```allowed_ips = []``` in your overide config, the final allowed_ips will be an empty list as well.
When using directories, the file entries can be filtered by name with the ```--config-keyword``` argument, which can be passed multiple times to add more keywords. If passed, then only config files with file names that contain all keywords will be merged.
When passing multiple config files, later --config-path given in the command will always overide previous ones. Directory config files are merged in alphabetical order by name, so ```config_b.toml``` will overide ```config_a.toml```.
There are two ways to merge config files. The default behavior is to completely replace any base fields with whatever fields are present in the overide config. So if you pass ```allowed_ips = []``` in your overide config, the final allowed_ips will be an empty list as well.
```--merge-nested-config``` will merge config fields recursively and extend config array fields.

View File

@@ -1,6 +1,6 @@
[package]
name = "db_client"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_helpers"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
authors = ["MoghTech"]
description = "helpers used as dependency for mogh tech monitor"

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_client"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
authors = ["MoghTech"]
description = "a client to interact with the monitor system"
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
monitor_types = "0.2.13"
monitor_types = "0.2.14"
reqwest = { version = "0.11", features = ["json"] }
tokio-tungstenite = { version = "0.18", features=["native-tls"] }
tokio = { version = "1.25", features = ["full"] }

View File

@@ -1,6 +1,6 @@
[package]
name = "periphery_client"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_types"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
authors = ["MoghTech"]
description = "types for the mogh tech monitor"

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_periphery"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
authors = ["MoghTech"]
description = "monitor periphery binary"
@@ -33,4 +33,4 @@ toml = "0.7"
daemonize = "0.5.0"
clap = { version = "4.2", features = ["derive"] }
svi = "0.1.3"
merge_config_files = "0.1.2"
merge_config_files = "0.1.3"

View File

@@ -71,7 +71,6 @@ pub fn load() -> (Args, u16, PeripheryConfigExtension, HomeDirExtension) {
.into_iter()
.map(|p| p.replace("~", &home_dir))
.collect::<Vec<_>>();
println!("{config_paths:?}");
let env_match_keywords = parse_comma_seperated_list(env.config_keywords)
.expect("failed to parse environemt CONFIG_KEYWORDS into comma seperated list");
let match_keywords = args