diff options
Diffstat (limited to 'src/args.rs')
-rw-r--r-- | src/args.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs index 590ac14..8de05ad 100644 --- a/src/args.rs +++ b/src/args.rs @@ -80,6 +80,14 @@ pub struct CliArgs { )] pub auth: Vec<auth::RequiredAuth>, + /// Read authentication values from a file. Example file content: + /// + /// joe:123 + /// bob:sha256:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3 + /// bill: + #[arg(long, value_hint = ValueHint::FilePath, env = "MINISERVE_AUTH_FILE")] + pub auth_file: Option<PathBuf>, + /// Use a specific route prefix #[arg(long = "route-prefix", env = "MINISERVE_ROUTE_PREFIX")] pub route_prefix: Option<String>, @@ -249,7 +257,7 @@ fn parse_interface(src: &str) -> Result<IpAddr, std::net::AddrParseError> { } /// Parse authentication requirement -fn parse_auth(src: &str) -> Result<auth::RequiredAuth, ContextualError> { +pub fn parse_auth(src: &str) -> Result<auth::RequiredAuth, ContextualError> { let mut split = src.splitn(3, ':'); let invalid_auth_format = Err(ContextualError::InvalidAuthFormat); |