index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-04-27 20:09:11.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-04-27 20:09:11.0 +00:00:00
commit
1636b21e7dae2055e767ba52ba933d41022aae9d [patch]
tree
8b677dc9f1cf7259119f78df1d20b26238ac9f5b
parent
137aefa2bedfdf5fa6e8c9adbc5c676e55a3da4e
download
1636b21e7dae2055e767ba52ba933d41022aae9d.tar.gz

refactor: drop support for cli compression option because of 137aefa



Diff

 README.md     | 6 +-----
 src/config.rs | 5 -----
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 5b83776..73985e6 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
- Memory safety and very reduced CPU and RAM overhead.
- Blazing fast static files-serving and asynchronous powered by [Warp]https://github.com/seanmonstar/warp/ `v0.3` ([Hyper]https://github.com/hyperium/hyper/ `v0.14`), [Tokio]https://github.com/tokio-rs/tokio `v1` and a set of [awesome crates]./Cargo.toml.
- Suitable for lightweight [GNU/Linux Docker containers]https://hub.docker.com/r/joseluisq/static-web-server/tags. It's a fully __5MB__ static binary thanks to [Rust and Musl libc]https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html.
- Opt-in GZip or Brotli compression for text-based web files only.
- GZip, Deflate or Brotli compression for text-based web files only.
- Compression on demand via [Accept-Encoding]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding header.
- [Partial Content Delivery]https://en.wikipedia.org/wiki/Byte_serving support for byte-serving of large files.
- [Cache Control]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control headers for assets.
@@ -48,7 +48,6 @@ Server can be configured either via environment variables or their equivalent co
| `SERVER_LOG_LEVEL`          | Specify a logging level in lower case. (Values `error`, `warn`, `info`, `debug`, `trace`).                                                                                                                                                                                                                                                                                                         | Default `error`                                                                                                                 |
| `SERVER_ERROR_PAGE_404`     | HTML file path for 404 errors.                                                                                                                                                                                                                                                                                                                                                                     | If path is not specified or simply don't exists then server will use a generic HTML error message. Default `./public/404.html`. |
| `SERVER_ERROR_PAGE_50X`     | HTML file path for 50x errors.                                                                                                                                                                                                                                                                                                                                                                     | If path is not specified or simply don't exists then server will use a generic HTML error message. Default `./public/50x.html`  |
| `SERVER_COMPRESSION`        | Compression body support for web text-based file types. Values: `gzip` or `brotli`.                                                                                                                                                                                                                                                                                                     | Default: `gzip`                                                                                                                 |
| `SERVER_THREADS_MULTIPLIER` | Number of worker threads multiplier that'll be multiplied by the number of system CPUs using the formula: `worker threads = number of CPUs * n` where `n` is the value that changes here. When multiplier value is 0 or 1 then the `number of CPUs` is used.  Number of worker threads result should be a number between 1 and 32,768 though it is advised to keep this value on the smaller side. | Default `8`                                                                                                                     |
| `SERVER_HTTP2_TLS`          | Enable HTTP/2 with TLS support. Make sure also to adjust current server port.                                                                                                                                                                                                                                                                                                                      | Default `false`                                                                                                                 |
| `SERVER_HTTP2_TLS_CERT`     | Specify the file path to read the certificate.                                                                                                                                                                                                                                                                                                                                                     | Default empty                                                                                                                   |
@@ -71,9 +70,6 @@ FLAGS:
    -V, --version    Prints version information

OPTIONS:
    -x, --compression <compression>
            Compression body support for text-based web file types only. Values: "gzip" or "brotli". Use an empty value
            to skip compression [env: SERVER_COMPRESSION=]  [default: gzip]
    -c, --cors-allow-origins <cors-allow-origins>
            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 [env: SERVER_CORS_ALLOW_ORIGINS=]  [default: ]
diff --git a/src/config.rs b/src/config.rs
index 80ef800..b3240c5 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -46,11 +46,6 @@ pub struct Config {
    /// HTML file path for 404 errors. If path is not specified or simply don't exists then server will use a generic HTML error message.
    pub page404: String,

    #[structopt(long, short = "x", default_value = "gzip", env = "SERVER_COMPRESSION")]
    /// Compression body support for text-based web file types only. Values: "gzip" or "brotli".
    /// Use an empty value to skip compression.
    pub compression: String,

    #[structopt(long, short = "g", default_value = "error", env = "SERVER_LOG_LEVEL")]
    /// Specify a logging level in lower case. Values: error, warn, info, debug or trace
    pub log_level: String,