@@ -4,30 +4,30 @@ use bencher_endpoint::Registrar;
44#[ cfg( feature = "plus" ) ]
55use bencher_json:: system:: config:: { JsonLitestream , JsonPlus } ;
66use bencher_json:: {
7+ JsonConfig ,
78 system:: config:: {
89 IfExists , JsonConsole , JsonDatabase , JsonLogging , JsonSecurity , JsonServer , JsonSmtp ,
910 JsonTls , LogLevel , ServerLog ,
1011 } ,
11- JsonConfig ,
1212} ;
1313use bencher_rbac:: init_rbac;
1414use bencher_schema:: context:: { ApiContext , Database , DbConnection } ;
1515#[ cfg( feature = "plus" ) ]
1616use bencher_schema:: { context:: RateLimiting , model:: server:: QueryServer } ;
1717use bencher_token:: TokenKey ;
18+ use diesel:: Connection ;
1819#[ cfg( feature = "plus" ) ]
1920use diesel:: connection:: SimpleConnection ;
20- use diesel:: Connection ;
2121use dropshot:: {
2222 ApiDescription , ConfigDropshot , ConfigLogging , ConfigLoggingIfExists , ConfigLoggingLevel ,
2323 ConfigTls , HttpServer ,
2424} ;
25- use slog:: { debug, error, info, Logger } ;
25+ use slog:: { Logger , debug, error, info} ;
2626use tokio:: sync:: mpsc:: Sender ;
2727
2828use super :: Config ;
2929#[ cfg( feature = "plus" ) ]
30- use super :: { plus:: Plus , DEFAULT_BUSY_TIMEOUT } ;
30+ use super :: { DEFAULT_BUSY_TIMEOUT , plus:: Plus } ;
3131
3232const DATABASE_URL : & str = "DATABASE_URL" ;
3333
@@ -273,7 +273,12 @@ fn diesel_database_url(log: &Logger, database_path: &str) {
273273 debug ! ( log, "Failed to find \" {DATABASE_URL}\" " ) ;
274274 }
275275 debug ! ( log, "Setting \" {DATABASE_URL}\" to {database_path}" ) ;
276- std:: env:: set_var ( DATABASE_URL , database_path) ;
276+ // SAFETY: This is safe because we are setting the environment variable
277+ // from a single thread at startup.
278+ #[ allow( unsafe_code, reason = "set environment variable" ) ]
279+ unsafe {
280+ std:: env:: set_var ( DATABASE_URL , database_path) ;
281+ }
277282}
278283
279284#[ cfg( feature = "plus" ) ]
0 commit comments