@@ -109,6 +109,7 @@ where
109109 }
110110
111111 if cli. validate_config {
112+ validate_runtime_config ( & config) ?;
112113 return Ok ( ( ) ) ;
113114 }
114115
@@ -119,6 +120,17 @@ where
119120 crate :: runtime:: run ( config)
120121}
121122
123+ #[ cfg( feature = "proxy" ) ]
124+ fn validate_runtime_config ( config : & Config ) -> Result < ( ) , Box < dyn Error + Send + Sync > > {
125+ crate :: proxy:: FluxProxy :: from_config ( config) ?;
126+ Ok ( ( ) )
127+ }
128+
129+ #[ cfg( not( feature = "proxy" ) ) ]
130+ fn validate_runtime_config ( _config : & Config ) -> Result < ( ) , Box < dyn Error + Send + Sync > > {
131+ Ok ( ( ) )
132+ }
133+
122134fn run_command (
123135 command : & CliCommand ,
124136 config_path : Option < & std:: path:: Path > ,
@@ -299,6 +311,23 @@ mod tests {
299311 . unwrap ( ) ;
300312 }
301313
314+ #[ test]
315+ fn validate_config_rejects_missing_static_root ( ) {
316+ let dir = TestDir :: new ( "cli-validate-missing-root" ) ;
317+ let missing_root = safe_child_path ( & dir. path , "missing-site" ) ;
318+ let config = dir. web_config ( "fluxheim.toml" , "example" , "example.test" , & missing_root) ;
319+
320+ let error = run_from_args ( [
321+ "fluxheim" ,
322+ "--config" ,
323+ config. to_str ( ) . unwrap ( ) ,
324+ "--validate-config" ,
325+ ] )
326+ . unwrap_err ( ) ;
327+
328+ assert ! ( error. to_string( ) . contains( "web root does not exist" ) ) ;
329+ }
330+
302331 #[ test]
303332 fn snapshot_command_creates_store_snapshot ( ) {
304333 let dir = TestDir :: new ( "cli-snapshot-command" ) ;
@@ -417,6 +446,26 @@ mod tests {
417446 path
418447 }
419448
449+ fn web_config ( & self , name : & str , vhost_name : & str , host : & str , root : & Path ) -> PathBuf {
450+ let path = safe_child_path ( & self . path , name) ;
451+ fs:: write (
452+ & path,
453+ format ! (
454+ r#"
455+ [[vhosts]]
456+ name = "{vhost_name}"
457+ hosts = ["{host}"]
458+
459+ [vhosts.web]
460+ root = "{}"
461+ "# ,
462+ root. display( )
463+ ) ,
464+ )
465+ . expect ( "write config" ) ;
466+ path
467+ }
468+
420469 fn minimal_config ( & self , name : & str , listen : & str ) -> PathBuf {
421470 let path = safe_child_path ( & self . path , name) ;
422471 fs:: write (
0 commit comments