From 0d2762d82f7d87b4c4568e1047d1c7d1cabb88d6 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Wed, 19 May 2021 22:59:53 +0200 Subject: [PATCH] refactor: explicit bool literals for --directory-listing and --http2 since via structopt is "not possible" to use optional boolean values we want consistency for all bool flags (e.g --flag=true|false) --- src/config.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 6bbda94..7137243 100644 --- a/src/config.rs +++ b/src/config.rs @@ -56,7 +56,13 @@ pub struct Config { /// Specify an optional CORS list of allowed origin hosts separated by comas. Host ports or protocols aren't being checked. Use an asterisk (*) to allow any host. pub cors_allow_origins: String, - #[structopt(long, short = "t", env = "SERVER_HTTP2_TLS")] + #[structopt( + long, + short = "t", + parse(try_from_str), + default_value = "false", + env = "SERVER_HTTP2_TLS" + )] /// Enable HTTP/2 with TLS support. pub http2: bool, @@ -72,6 +78,7 @@ pub struct Config { long, short = "z", parse(try_from_str), + default_value = "false", env = "SERVER_DIRECTORY_LISTING" )] /// Enable directory listing for all requests ending with the slash character (‘/’). -- libgit2 1.7.2