diff options
author | Alex Auvolat <alex@adnab.me> | 2023-02-06 12:23:55 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-02-06 12:23:55 +0100 |
commit | 80e232699825c5c512e8714e08b6a80992a06498 (patch) | |
tree | 1e713f92010022936529eb5c98329966885e4ca8 /src | |
parent | 656b8d42de2fc945c988094418c90d29d000be32 (diff) | |
download | garage-80e232699825c5c512e8714e08b6a80992a06498.tar.gz garage-80e232699825c5c512e8714e08b6a80992a06498.zip |
fixes for pr 499config-files-env
Diffstat (limited to 'src')
-rw-r--r-- | src/garage/main.rs | 3 | ||||
-rw-r--r-- | src/util/config.rs | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/garage/main.rs b/src/garage/main.rs index 2bd0164e..1ab18bb2 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -65,7 +65,8 @@ struct Opt { #[derive(StructOpt, Debug)] pub struct Secrets { - /// RPC secret network key, used to replace rpc_secret in config.toml when running the daemon or doing admin operations + /// RPC secret network key, used to replace rpc_secret in config.toml when running the + /// daemon or doing admin operations #[structopt(short = "s", long = "rpc-secret", env = "GARAGE_RPC_SECRET")] pub rpc_secret: Option<String>, diff --git a/src/util/config.rs b/src/util/config.rs index c59e9c1d..2176353e 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -190,17 +190,17 @@ pub fn read_config(config_file: PathBuf) -> Result<Config, Error> { secret_from_file( &mut parsed_config.rpc_secret, - &mut parsed_config.rpc_secret_file, + &parsed_config.rpc_secret_file, "rpc_secret", )?; secret_from_file( &mut parsed_config.admin.metrics_token, - &mut parsed_config.admin.metrics_token_file, + &parsed_config.admin.metrics_token_file, "admin.metrics_token", )?; secret_from_file( &mut parsed_config.admin.admin_token, - &mut parsed_config.admin.admin_token_file, + &parsed_config.admin.admin_token_file, "admin.admin_token", )?; @@ -209,7 +209,7 @@ pub fn read_config(config_file: PathBuf) -> Result<Config, Error> { fn secret_from_file( secret: &mut Option<String>, - secret_file: &mut Option<String>, + secret_file: &Option<String>, name: &'static str, ) -> Result<(), Error> { match (&secret, &secret_file) { |