diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..eae7e90 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,23 @@ +# examples + + +## Static-Server + +```bash +cargo run -- -c=~/github/pingap/examples/static-serve.toml --admin=127.0.0.1:3018 +``` + +```bash +curl http://127.0.0.1:3000/ -v +``` + +## Proxy-Upstream + +Upstream features: + +- Support comresssion: zstd, br, gzip +- Static cache: public, max-age=31536000 + +```bash +cargo run -- -c=~/github/pingap/examples/proxy-upstream.toml --admin=127.0.0.1:3018 +``` diff --git a/examples/proxy-upstream.toml b/examples/proxy-upstream.toml new file mode 100644 index 0000000..48dc1f3 --- /dev/null +++ b/examples/proxy-upstream.toml @@ -0,0 +1,29 @@ +[basic] +cache_directory = "~/tmp/cache" +log_level = "INFO" + +[locations.charts] +path = "/" +plugins = [ + "pingap:acceptEncodingAdjustment", + "chartsCache", +] +upstream = "charts" + +[plugins.chartsCache] +category = "cache" +headers = ["Accept-Encoding"] +max_ttl = "1h" +namespace = "charts" +step = "request" + +[servers.charts] +addr = "127.0.0.1:3000" +locations = ["charts"] + +[upstreams.charts] +addrs = [ + "127.0.0.1:5000", + "127.0.0.1:5001", +] +health_check = "http://charts/ping" diff --git a/examples/static-serve.toml b/examples/static-serve.toml index 31c9110..168a487 100644 --- a/examples/static-serve.toml +++ b/examples/static-serve.toml @@ -1,23 +1,10 @@ [locations.staticServe] plugins = [ - "staticAcceptEncoding", - "staticCompression", + "pingap:acceptEncodingAdjustment", + "pingap:compression", "staticServe", ] -[plugins.staticAcceptEncoding] -category = "accept_encoding" -encodings = "zstd, br, gzip" -only_one_encoding = true -step = "request" - -[plugins.staticCompression] -br_level = 9 -category = "compression" -gzip_level = 9 -step = "request" -zstd_level = 9 - [plugins.staticServe] category = "directory" path = "~/github/pingap/dist"