Skip to content

Commit b8cffdc

Browse files
committed
Fix: JWT secret retrieve config file retrieval
Add handling environment variable for config path in JWT functions too. Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent b1014c5 commit b8cffdc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/storjwt.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ use rand::{distributions::Alphanumeric, Rng};
99
pub fn verify_jwt_token(token_str: &str) -> Result<BTreeMap<String, String>, jwt::Error> {
1010
// config.toml, jwt_secret parameter
1111
let args = Args::parse();
12-
let cfg_file = args.config_file;
12+
let mut cfg_file = args.config_file;
13+
// check if env variable available KCI_STORAGE_CONFIG
14+
if let Ok(env_cfg_file) = std::env::var("KCI_STORAGE_CONFIG") {
15+
cfg_file = env_cfg_file;
16+
}
1317
let toml_cfg = std::fs::read_to_string(&cfg_file).unwrap();
1418
let parsed_toml = toml_cfg.parse::<Table>().unwrap();
1519
let key_str = parsed_toml["jwt_secret"].as_str().unwrap();

0 commit comments

Comments
 (0)