Skip to content

Commit

Permalink
feat: allow specifying the path to config files on the command line
Browse files Browse the repository at this point in the history
  • Loading branch information
ashhhleyyy committed Jul 2, 2023
1 parent 16de5ed commit 96c84f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target
/.idea
/result
/.direnv

/wrapper_cache
config.toml
Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ pub struct Context {

#[tokio::main]
pub async fn main() {
let config_path = std::env::args().nth(1).unwrap_or_else(|| "config.toml".to_owned());
let destinations_path = std::env::args().nth(2).unwrap_or_else(|| "destinations.toml".to_owned());

loop {
let config: Config = config::load("config.toml").await;
let destinations: config::Destinations = config::load("destinations.toml").await;
let config: Config = config::load(&config_path).await;
let destinations: config::Destinations = config::load(&destinations_path).await;

let min_restart_interval = Duration::from_secs(config.min_restart_interval_seconds);

Expand Down

0 comments on commit 96c84f2

Please sign in to comment.