diff --git a/src/rb/auth.rs b/src/rb/auth.rs index 094e5fe..28bfa56 100644 --- a/src/rb/auth.rs +++ b/src/rb/auth.rs @@ -18,7 +18,7 @@ const JWT_EXP_SECONDS: i64 = 900; /// Amount of bytes the refresh tokens should consist of const REFRESH_TOKEN_N_BYTES: usize = 64; /// Expire time for refresh tokens; here: one week -const REFRESH_TOKEN_EXP_SECONDS: i64 = 36288000; +const REFRESH_TOKEN_EXP_SECONDS: i64 = 604800; fn log(message: &str, o: T) -> T { println!("{}", message); diff --git a/src/rbs/main.rs b/src/rbs/main.rs index 1792d9d..22657e5 100644 --- a/src/rbs/main.rs +++ b/src/rbs/main.rs @@ -1,5 +1,5 @@ // This needs to be explicitely included before diesel is imported to make sure -// compilation succeeds +// compilation succeeds in the release Docker image. extern crate openssl; #[macro_use] @@ -29,16 +29,9 @@ async fn run_db_migrations(rocket: Rocket) -> Result, Rocke } async fn create_admin_user(rocket: Rocket) -> Result, Rocket> { - // In debug mode, the admin user is just a test user - let (admin_user, admin_password): (String, String); + let admin_user = std::env::var("ADMIN_USER").unwrap_or(String::from("admin")); + let admin_password = std::env::var("ADMIN_PASSWORD").unwrap_or(String::from("password")); - // if rocket.config().profile == "debug" { - admin_user = String::from("test"); - admin_password = String::from("test"); - // }else{ - // admin_user = std::env::var("ADMIN_USER").expect("no admin user provided"); - // admin_password = std::env::var("ADMIN_PASSWORD").expect("no admin password provided"); - // } let conn = RbDbConn::get_one(&rocket) .await .expect("database connection"); @@ -59,5 +52,5 @@ fn rocket() -> _ { "Create admin user", create_admin_user )) - .mount("/auth", auth::routes()) + .mount("/api/auth", auth::routes()) }