File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,47 @@ fn compile_server(server: &ServerBlock) -> CompileResult<ServerConfig> {
102102 }
103103 }
104104
105+ // Process generic directives for settings like tls, client_max_body_size
106+ for directive in & server. directives {
107+ if let Directive :: Setting { key, value } = directive {
108+ match key. as_str ( ) {
109+ "client_max_body_size" => {
110+ if let Expr :: Integer ( size) = value {
111+ config. client_max_body_size = * size as u64 ;
112+ }
113+ }
114+ "tls" => {
115+ let mut tls = TlsConfig :: default ( ) ;
116+ match value {
117+ Expr :: Ident ( id) if id == "auto" => {
118+ tls. auto = true ;
119+ }
120+ Expr :: Map ( map) => {
121+ if let Some ( Expr :: Bool ( b) ) = map. get ( "auto" ) {
122+ tls. auto = * b;
123+ }
124+ if let Some ( Expr :: String ( s) ) = map. get ( "cert" ) {
125+ tls. cert = Some ( s. clone ( ) ) ;
126+ }
127+ if let Some ( Expr :: String ( s) ) = map. get ( "key" ) {
128+ tls. key = Some ( s. clone ( ) ) ;
129+ }
130+ if let Some ( Expr :: String ( s) ) = map. get ( "acme_email" ) {
131+ tls. acme_email = Some ( s. clone ( ) ) ;
132+ }
133+ if let Some ( Expr :: Bool ( b) ) = map. get ( "http3" ) {
134+ tls. http3 = * b;
135+ }
136+ }
137+ _ => { }
138+ }
139+ config. tls = Some ( tls) ;
140+ }
141+ _ => { }
142+ }
143+ }
144+ }
145+
105146 Ok ( config)
106147}
107148
You can’t perform that action at this time.
0 commit comments