Replacing with icarus_envy
This commit is contained in:
@@ -12,11 +12,13 @@ pub const MESSAGE: &str = "Something random";
|
|||||||
pub const ISSUER: &str = "icarus_auth";
|
pub const ISSUER: &str = "icarus_auth";
|
||||||
pub const AUDIENCE: &str = "icarus";
|
pub const AUDIENCE: &str = "icarus";
|
||||||
|
|
||||||
|
/*
|
||||||
pub fn get_key() -> Result<String, dotenvy::Error> {
|
pub fn get_key() -> Result<String, dotenvy::Error> {
|
||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
let key = std::env::var(KEY_ENV).expect("SECRET_KEY_NOT_FOUND");
|
let key = std::env::var(KEY_ENV).expect("SECRET_KEY_NOT_FOUND");
|
||||||
Ok(key)
|
Ok(key)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
pub fn get_issued() -> time::Result<time::OffsetDateTime> {
|
pub fn get_issued() -> time::Result<time::OffsetDateTime> {
|
||||||
Ok(time::OffsetDateTime::now_utc())
|
Ok(time::OffsetDateTime::now_utc())
|
||||||
@@ -51,7 +53,11 @@ pub fn create_token(provided_key: &String) -> Result<(String, i64), josekit::Jos
|
|||||||
payload.set_expires_at(&util::time_to_std_time(&expire).unwrap());
|
payload.set_expires_at(&util::time_to_std_time(&expire).unwrap());
|
||||||
|
|
||||||
let key: String = if provided_key.is_empty() {
|
let key: String = if provided_key.is_empty() {
|
||||||
get_key().unwrap()
|
// get_key().unwrap()
|
||||||
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
|
|
||||||
|
// Block on the async function to get the result
|
||||||
|
rt.block_on(icarus_envy::environment::get_secret_key())
|
||||||
} else {
|
} else {
|
||||||
provided_key.to_owned()
|
provided_key.to_owned()
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user