File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed
Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,10 @@ services {
129129 //
130130 // All files within the root will be available
131131 base-path "."
132+ // Redirect to an index file on URI like "/" GET, can include multiple options
133+ //
134+ // This is optional.
135+ index-file "index.html"
132136 }
133137 }
134138}
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ pub struct PathControl {
135135#[ derive( Debug , Clone ) ]
136136pub struct FileServerConfig {
137137 pub ( crate ) name : String ,
138+ pub ( crate ) index_file : Vec < String > ,
138139 pub ( crate ) listeners : Vec < ListenerConfig > ,
139140 pub ( crate ) base_path : Option < PathBuf > ,
140141}
Original file line number Diff line number Diff line change @@ -222,10 +222,22 @@ fn extract_file_server(
222222 None
223223 } ;
224224
225+ // Index File
226+ //
227+ let index_file = if let Some ( ( ifnode, ifargs) ) = map. get ( "index-file" ) {
228+ ifargs
229+ . iter ( )
230+ . filter_map ( |arg| arg. value ( ) . as_string ( ) . map ( ToOwned :: to_owned) )
231+ . collect ( )
232+ } else {
233+ vec ! [ ]
234+ } ;
235+
225236 Ok ( FileServerConfig {
226237 name : name. to_string ( ) ,
227238 listeners : list_cfgs,
228239 base_path,
240+ index_file,
229241 } )
230242}
231243
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ pub fn river_file_server(
1818 let fsconf = StaticFilesConf {
1919 root : conf. base_path ,
2020 canonicalize_uri : true ,
21- index_file : Vec :: new ( ) . into ( ) ,
21+ index_file : conf . index_file . into ( ) ,
2222 page_404 : None ,
2323 precompressed : Vec :: new ( ) . into ( ) ,
2424 ..Default :: default ( )
You can’t perform that action at this time.
0 commit comments