@@ -5,15 +5,15 @@ use once_cell::sync::Lazy;
5
5
use crate :: util:: errors:: { forbidden, AppResult } ;
6
6
7
7
static AUTHORIZED_ADMIN_USER_IDS : Lazy < HashSet < i32 > > =
8
- Lazy :: new ( || parse_authorized_admin_users ( dotenv :: var ( "GH_ADMIN_USER_IDS" ) ) ) ;
8
+ Lazy :: new ( || parse_authorized_admin_users ( dotenvy :: var ( "GH_ADMIN_USER_IDS" ) ) ) ;
9
9
10
10
// The defaults correspond to the current crates.io team, which as at the time of writing, is the
11
11
// GitHub user names carols10cents, jtgeibel, Turbo87, JohnTitor, LawnGnome, and mdtro.
12
12
//
13
13
// FIXME: this needs to be removed once we can detect the admins from the Rust teams API.
14
14
const DEFAULT_ADMIN_USER_IDS : [ i32 ; 6 ] = [ 193874 , 22186 , 141300 , 25030997 , 229984 , 20070360 ] ;
15
15
16
- fn parse_authorized_admin_users ( maybe_users : dotenv :: Result < String > ) -> HashSet < i32 > {
16
+ fn parse_authorized_admin_users ( maybe_users : dotenvy :: Result < String > ) -> HashSet < i32 > {
17
17
match maybe_users {
18
18
Ok ( users) => users
19
19
. split ( |c : char | !( c. is_ascii_digit ( ) ) )
@@ -70,7 +70,7 @@ mod tests {
70
70
71
71
#[ test]
72
72
fn test_parse_authorized_admin_users ( ) {
73
- fn assert_authorized ( input : dotenv :: Result < & str > , expected : & [ i32 ] ) {
73
+ fn assert_authorized ( input : dotenvy :: Result < & str > , expected : & [ i32 ] ) {
74
74
assert_eq ! (
75
75
parse_authorized_admin_users( input. map( String :: from) ) ,
76
76
expected. iter( ) . copied( ) . collect( )
@@ -84,7 +84,7 @@ mod tests {
84
84
assert_authorized ( Ok ( "12345;6789" ) , & [ 12345 , 6789 ] ) ;
85
85
assert_authorized ( Ok ( "12345;6789;12345" ) , & [ 12345 , 6789 ] ) ;
86
86
87
- let not_found_error = dotenv :: Error :: Io ( io:: Error :: new ( ErrorKind :: NotFound , "not found" ) ) ;
87
+ let not_found_error = dotenvy :: Error :: Io ( io:: Error :: new ( ErrorKind :: NotFound , "not found" ) ) ;
88
88
assert_authorized ( Err ( not_found_error) , DEFAULT_ADMIN_USER_IDS . as_slice ( ) ) ;
89
89
}
90
90
}
0 commit comments