@@ -4,30 +4,30 @@ use bencher_endpoint::Registrar;
4
4
#[ cfg( feature = "plus" ) ]
5
5
use bencher_json:: system:: config:: { JsonLitestream , JsonPlus } ;
6
6
use bencher_json:: {
7
+ JsonConfig ,
7
8
system:: config:: {
8
9
IfExists , JsonConsole , JsonDatabase , JsonLogging , JsonSecurity , JsonServer , JsonSmtp ,
9
10
JsonTls , LogLevel , ServerLog ,
10
11
} ,
11
- JsonConfig ,
12
12
} ;
13
13
use bencher_rbac:: init_rbac;
14
14
use bencher_schema:: context:: { ApiContext , Database , DbConnection } ;
15
15
#[ cfg( feature = "plus" ) ]
16
16
use bencher_schema:: { context:: RateLimiting , model:: server:: QueryServer } ;
17
17
use bencher_token:: TokenKey ;
18
+ use diesel:: Connection ;
18
19
#[ cfg( feature = "plus" ) ]
19
20
use diesel:: connection:: SimpleConnection ;
20
- use diesel:: Connection ;
21
21
use dropshot:: {
22
22
ApiDescription , ConfigDropshot , ConfigLogging , ConfigLoggingIfExists , ConfigLoggingLevel ,
23
23
ConfigTls , HttpServer ,
24
24
} ;
25
- use slog:: { debug, error, info, Logger } ;
25
+ use slog:: { Logger , debug, error, info} ;
26
26
use tokio:: sync:: mpsc:: Sender ;
27
27
28
28
use super :: Config ;
29
29
#[ cfg( feature = "plus" ) ]
30
- use super :: { plus:: Plus , DEFAULT_BUSY_TIMEOUT } ;
30
+ use super :: { DEFAULT_BUSY_TIMEOUT , plus:: Plus } ;
31
31
32
32
const DATABASE_URL : & str = "DATABASE_URL" ;
33
33
@@ -273,7 +273,12 @@ fn diesel_database_url(log: &Logger, database_path: &str) {
273
273
debug ! ( log, "Failed to find \" {DATABASE_URL}\" " ) ;
274
274
}
275
275
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
+ }
277
282
}
278
283
279
284
#[ cfg( feature = "plus" ) ]
0 commit comments