index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-05-19 20:59:53.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-05-19 20:59:53.0 +00:00:00
commit
0d2762d82f7d87b4c4568e1047d1c7d1cabb88d6 [patch]
tree
8c8d5240f1cd53ba158268d5c9bb83e916bbbbb5
parent
5428eb363b693f74285ba8d66edf4bad1778b3ba
download
0d2762d82f7d87b4c4568e1047d1c7d1cabb88d6.tar.gz

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)

Diff

 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 (‘/’).