aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorEli Flanagan <eli@typedspace.com>2019-09-12 23:57:21 +0000
committerEli Flanagan <eli@typedspace.com>2019-09-12 23:57:21 +0000
commitb3f170e7edf77e6a37f11af8701d427a9b2fe204 (patch)
tree93270e8f2f4232a3d825b952550113543bce28bd /src/main.rs
parentuse actix-web method for static index (diff)
downloadminiserve-b3f170e7edf77e6a37f11af8701d427a9b2fe204.tar.gz
miniserve-b3f170e7edf77e6a37f11af8701d427a9b2fe204.zip
change to path option for configurability
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index f2dd351..5db9b31 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -52,8 +52,8 @@ pub struct MiniserveConfig {
/// Default color scheme
pub default_color_scheme: themes::ColorScheme,
- /// Serve index.* files by default
- pub default_index: bool,
+ /// name of an index files to serve by default
+ pub index: Option<std::path::PathBuf>,
/// Enable file upload
pub file_upload: bool,
@@ -237,11 +237,11 @@ fn configure_app(app: App<MiniserveConfig>) -> App<MiniserveConfig> {
};
if path.is_file() {
None
- } else if app.state().default_index == true {
+ } else if let Some(index_file) = &app.state().index {
Some(
fs::StaticFiles::new(path)
.expect("Failed to setup static file handler")
- .index_file("index.html")
+ .index_file(index_file.to_string_lossy())
)
} else {
let u_r = upload_route.clone();