storopoli / dead-man-switch

Rust no-BS Dead Man's Switch TUI
GNU Affero General Public License v3.0
8 stars 1 forks source link

feat(CLI): add `--config` CLI argument #14

Open storopoli opened 2 months ago

storopoli commented 2 months ago

Right now the config is hardcoded to be created/read in the OS-agnostic config dir. We need a CLI argument to override it.

Something like:

dead_man_switch -c myconfig.toml
jaoleal commented 2 weeks ago

Maybe we could rely on environment variables

use std::env;

let key = "DEAD_MAN_CONFIG";
match env::var(key) {
    Ok(val) => { do_something_with_val(val)},
    Err(e) => {do_nothing()},
}
storopoli commented 2 weeks ago

I don't like env vars, I want this to be a CLI argument that you can override.

storopoli commented 2 weeks ago

ENV vars are good for set and forget stuff. I want to be able to run several DMS with different TOML configs.

jaoleal commented 2 weeks ago

Instead of running multiple instances of DMS the --config arg can be set as a array of paths to watch and iterate over TOML configs... This could be useful when developing the https://github.com/storopoli/dead-man-switch/issues/31 daemon mode

jaoleal commented 2 weeks ago

with some good byte abstraction, all the TOMLS can be tracked and loaded in memory only retrieving the warning time and the path.

Users no more need to fit all the secrets in one toml (if using the way it should be used). Could have several tomls for each secrets

storopoli commented 2 weeks ago

KISS, let's first implement the simple baby-steps one config?

I don't want to overbloat this with tokio or std::threads