mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
feat(config): read secrets from NAME_FILE variables (#1421)
Co-authored-by: Hampus <[email protected]>
This commit is contained in:
@@ -48,7 +48,9 @@ pub enum StorageBackendArg {
|
||||
}
|
||||
|
||||
pub fn load_config(args: &Args) -> anyhow::Result<Config> {
|
||||
load_config_from_iter(args, std::env::vars())
|
||||
let vars =
|
||||
fluxer_common::config::resolve_env_files(std::env::vars()).map_err(anyhow::Error::msg)?;
|
||||
load_config_from_iter(args, vars)
|
||||
}
|
||||
|
||||
pub fn load_config_from_iter<I, K, V>(args: &Args, vars: I) -> anyhow::Result<Config>
|
||||
|
||||
@@ -13,7 +13,7 @@ use parse::{
|
||||
parse_mode_env, parse_policy_mode, parse_storage_backend, parse_u16, parse_u64, parse_usize,
|
||||
validate_read_endpoint,
|
||||
};
|
||||
use std::{env, path::PathBuf};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum StorageBackend {
|
||||
@@ -144,10 +144,6 @@ pub struct Config {
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load_from_env() -> anyhow::Result<Self> {
|
||||
Self::load_from_iter(env::vars())
|
||||
}
|
||||
|
||||
pub fn load_from_iter<I, K, V>(vars: I) -> anyhow::Result<Self>
|
||||
where
|
||||
I: IntoIterator<Item = (K, V)>,
|
||||
|
||||
Reference in New Issue
Block a user