@@ -186,9 +186,6 @@ pub struct Configuration {
186186
187187 /// Time interval at which usage metrics are persisted in event database (in seconds).
188188 pub persist_usage_report_interval_in_seconds : u64 ,
189-
190- /// If set to true, the HTTP server can serve static directories.
191- pub allow_http_serve_directory : bool ,
192189}
193190
194191/// Uploader needed to copy the snapshot once computed.
@@ -273,7 +270,6 @@ impl Configuration {
273270 metrics_server_ip : "0.0.0.0" . to_string ( ) ,
274271 metrics_server_port : 9090 ,
275272 persist_usage_report_interval_in_seconds : 10 ,
276- allow_http_serve_directory : false ,
277273 }
278274 }
279275
@@ -336,6 +332,15 @@ impl Configuration {
336332
337333 Ok ( allowed_discriminants)
338334 }
335+
336+ /// Check if the HTTP server can serve static directories.
337+ // TODO: This function should be completed when the configuration of the uploaders for the Cardano database is done.
338+ pub fn allow_http_serve_directory ( & self ) -> bool {
339+ match self . snapshot_uploader_type {
340+ SnapshotUploaderType :: Local => true ,
341+ SnapshotUploaderType :: Gcp => false ,
342+ }
343+ }
339344}
340345
341346/// Default configuration with all the default values for configurations.
@@ -415,9 +420,6 @@ pub struct DefaultConfiguration {
415420
416421 /// Time interval at which metrics are persisted in event database (in seconds).
417422 pub persist_usage_report_interval_in_seconds : u64 ,
418-
419- /// If set to true, the HTTP server can serve static directories.
420- pub allow_http_serve_directory : bool ,
421423}
422424
423425impl Default for DefaultConfiguration {
@@ -450,7 +452,6 @@ impl Default for DefaultConfiguration {
450452 metrics_server_ip : "0.0.0.0" . to_string ( ) ,
451453 metrics_server_port : 9090 ,
452454 persist_usage_report_interval_in_seconds : 10 ,
453- allow_http_serve_directory : false ,
454455 }
455456 }
456457}
@@ -538,7 +539,6 @@ impl Source for DefaultConfiguration {
538539 ) ,
539540 ] ) ) ,
540541 ) ;
541- insert_default_configuration ! ( result, myself. allow_http_serve_directory) ;
542542 Ok ( result)
543543 }
544544}
@@ -608,4 +608,21 @@ mod test {
608608 BTreeSet :: from( SignedEntityConfig :: DEFAULT_ALLOWED_DISCRIMINANTS )
609609 ) ;
610610 }
611+
612+ #[ test]
613+ fn allow_http_serve_directory ( ) {
614+ let config = Configuration {
615+ snapshot_uploader_type : SnapshotUploaderType :: Local ,
616+ ..Configuration :: new_sample ( )
617+ } ;
618+
619+ assert ! ( config. allow_http_serve_directory( ) ) ;
620+
621+ let config = Configuration {
622+ snapshot_uploader_type : SnapshotUploaderType :: Gcp ,
623+ ..Configuration :: new_sample ( )
624+ } ;
625+
626+ assert ! ( !config. allow_http_serve_directory( ) ) ;
627+ }
611628}
0 commit comments