File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ pub struct Server {
9797 /// Disables API token creation when set to any non-empty value.
9898 /// The value is used as the error message returned to users.
9999 pub disable_token_creation : Option < String > ,
100+
101+ /// Banner message to display on all pages (e.g., for security incidents).
102+ pub banner_message : Option < String > ,
100103}
101104
102105impl Server {
@@ -202,6 +205,7 @@ impl Server {
202205 let domain_name = dotenvy:: var ( "DOMAIN_NAME" ) . unwrap_or_else ( |_| "crates.io" . into ( ) ) ;
203206 let trustpub_audience = var ( "TRUSTPUB_AUDIENCE" ) ?. unwrap_or_else ( || domain_name. clone ( ) ) ;
204207 let disable_token_creation = var ( "DISABLE_TOKEN_CREATION" ) ?. filter ( |s| !s. is_empty ( ) ) ;
208+ let banner_message = var ( "BANNER_MESSAGE" ) ?. filter ( |s| !s. is_empty ( ) ) ;
205209
206210 Ok ( Server {
207211 db : DatabasePools :: full_from_environment ( & base) ?,
@@ -253,6 +257,7 @@ impl Server {
253257 content_security_policy : Some ( content_security_policy. parse ( ) ?) ,
254258 trustpub_audience,
255259 disable_token_creation,
260+ banner_message,
256261 } )
257262 }
258263}
Original file line number Diff line number Diff line change @@ -527,6 +527,7 @@ fn simple_config() -> config::Server {
527527 content_security_policy : None ,
528528 trustpub_audience : AUDIENCE . to_string ( ) ,
529529 disable_token_creation : None ,
530+ banner_message : None ,
530531 }
531532}
532533
You can’t perform that action at this time.
0 commit comments