aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-03-07 10:00:48 +0000
committerSven-Hendrik Haase <svenstaro@gmail.com>2025-03-07 11:14:03 +0000
commit11ea8a19d1481b0660e5a2765da6e67d3e8aa72c (patch)
tree341cb7ac4bd5915deb8fe58947b3cc352687556d /src/config.rs
parentReformat style.scss (diff)
downloadminiserve-11ea8a19d1481b0660e5a2765da6e67d3e8aa72c.tar.gz
miniserve-11ea8a19d1481b0660e5a2765da6e67d3e8aa72c.zip
Add asynchronous directory size counting
This is enabled by default and without an option to toggle it off as it's asynchronous and shouldn't block the server thread.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/config.rs b/src/config.rs
index efec515..eecc45e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -24,7 +24,7 @@ const ROUTE_ALPHABET: [char; 16] = [
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f',
];
-#[derive(Clone)]
+#[derive(Debug, Clone)]
/// Configuration of the Miniserve application
pub struct MiniserveConfig {
/// Enable verbose mode
@@ -66,6 +66,9 @@ pub struct MiniserveConfig {
/// Well-known healthcheck route (prefixed if route_prefix is provided)
pub healthcheck_route: String,
+ /// Well-known API route (prefixed if route_prefix is provided)
+ pub api_route: String,
+
/// Well-known favicon route (prefixed if route_prefix is provided)
pub favicon_route: String,
@@ -206,15 +209,17 @@ impl MiniserveConfig {
// If --random-route is enabled, in order to not leak the random generated route, we must not use it
// as static files prefix.
// Otherwise, we should apply route_prefix to static files.
- let (healthcheck_route, favicon_route, css_route) = if args.random_route {
+ let (healthcheck_route, api_route, favicon_route, css_route) = if args.random_route {
(
"/__miniserve_internal/healthcheck".into(),
+ "/__miniserve_internal/api".into(),
"/__miniserve_internal/favicon.svg".into(),
"/__miniserve_internal/style.css".into(),
)
} else {
(
format!("{}/{}", route_prefix, "__miniserve_internal/healthcheck"),
+ format!("{}/{}", route_prefix, "__miniserve_internal/api"),
format!("{}/{}", route_prefix, "__miniserve_internal/favicon.svg"),
format!("{}/{}", route_prefix, "__miniserve_internal/style.css"),
)
@@ -305,6 +310,7 @@ impl MiniserveConfig {
default_sorting_order: args.default_sorting_order,
route_prefix,
healthcheck_route,
+ api_route,
favicon_route,
css_route,
default_color_scheme,