diff --git a/src/main.rs b/src/main.rs index 49a0513..450e206 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,19 +102,19 @@ async fn launch() -> _ { .connect(&act_database_url).await .expect("unable to create pool"); - static S3_URL_STRING: Lazy> = Lazy::new(|| + pub static S3_URL_STRING: Lazy> = Lazy::new(|| env::var("S3_URL").expect("S3_URL not specified").into_boxed_str() ); - static S3_URL: Lazy = Lazy::new(|| + pub static S3_URL: Lazy = Lazy::new(|| S3_URL_STRING.parse().unwrap() ); - static S3_USER: Lazy> = Lazy::new(|| + pub static S3_USER: Lazy> = Lazy::new(|| env::var("S3_USER").expect("S3_USER not specified").into_boxed_str() ); - static S3_PASSWD: Lazy> = Lazy::new(|| + pub static S3_PASSWD: Lazy> = Lazy::new(|| env::var("S3_PASSWD").expect("S3_PASSWD not specified").into_boxed_str() ); diff --git a/src/nnid/people.rs b/src/nnid/people.rs index 376a5c6..4cc8cff 100644 --- a/src/nnid/people.rs +++ b/src/nnid/people.rs @@ -31,6 +31,22 @@ const DATABASE_ERROR: Errors = Errors{ ] }; +pub static S3_URL_STRING: Lazy> = Lazy::new(|| + env::var("S3_URL").expect("S3_URL not specified").into_boxed_str() +); + +pub static S3_URL: Lazy = Lazy::new(|| + S3_URL_STRING.parse().unwrap() +); + +pub static S3_USER: Lazy> = Lazy::new(|| + env::var("S3_USER").expect("S3_USER not specified").into_boxed_str() +); + +pub static S3_PASSWD: Lazy> = Lazy::new(|| + env::var("S3_PASSWD").expect("S3_PASSWD not specified").into_boxed_str() +); + fn get_mii_img_url_path(pid: i32, format: &str) -> String{ format!("mii/{}/main.{}", pid, format) }