@@ -12,7 +12,7 @@ use crate::config::cdn_log_storage::CdnLogStorageConfig;
12
12
use crate :: config:: CdnLogQueueConfig ;
13
13
use crate :: middleware:: cargo_compat:: StatusCodeConfig ;
14
14
use crate :: storage:: StorageConfig ;
15
- use crates_io_env_vars:: { list, list_parsed, required_var, required_var_parsed , var, var_parsed} ;
15
+ use crates_io_env_vars:: { list, list_parsed, required_var, var, var_parsed} ;
16
16
use http:: HeaderValue ;
17
17
use std:: collections:: { HashMap , HashSet } ;
18
18
use std:: convert:: Infallible ;
@@ -74,8 +74,6 @@ pub struct Server {
74
74
75
75
/// Should the server serve the frontend `index.html` for all
76
76
/// non-API requests?
77
- /// Setting this parameter requires setting
78
- /// [`Self::og_image_base_url`] as well.
79
77
pub serve_html : bool ,
80
78
81
79
/// Base URL for the service from which the OpenGraph images
@@ -184,14 +182,6 @@ impl Server {
184
182
cdn_domain = storage. cdn_prefix. as_ref( ) . map( |cdn_prefix| format!( "https://{cdn_prefix}" ) ) . unwrap_or_default( )
185
183
) ;
186
184
187
- let serve_html = var_parsed ( "SERVE_HTML" ) ?. unwrap_or ( true ) ;
188
- let og_image_base_url = serve_html
189
- . then ( || {
190
- required_var_parsed ( "OG_IMAGE_BASE_URL" )
191
- . context ( "OG_IMAGE_BASE_URL must be set when using INDEX_HTML_TEMPLATE_PATH" )
192
- } )
193
- . transpose ( ) ?;
194
-
195
185
Ok ( Server {
196
186
db : DatabasePools :: full_from_environment ( & base) ?,
197
187
storage,
@@ -236,7 +226,7 @@ impl Server {
236
226
. unwrap_or ( StatusCodeConfig :: AdjustAll ) ,
237
227
serve_dist : true ,
238
228
serve_html : true ,
239
- og_image_base_url,
229
+ og_image_base_url : var_parsed ( "OG_IMAGE_BASE_URL" ) ? ,
240
230
html_render_cache_max_capacity : var_parsed ( "HTML_RENDER_CACHE_CAP" ) ?. unwrap_or ( 1024 ) ,
241
231
content_security_policy : Some ( content_security_policy. parse ( ) ?) ,
242
232
} )
0 commit comments