]> Untitled Git - lemmy.git/blobdiff - crates/utils/src/claims.rs
Moving settings and secrets to context.
[lemmy.git] / crates / utils / src / claims.rs
index 2b6ce9854d65fa5ced7ee49c89008e2f2200db00..d68b4119d3f7ab2cc794b7f238004c40c7960ca3 100644 (file)
@@ -1,4 +1,4 @@
-use crate::{settings::structs::Settings, LemmyError};
+use crate::LemmyError;
 use chrono::Utc;
 use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, TokenData, Validation};
 use serde::{Deserialize, Serialize};
@@ -24,10 +24,10 @@ impl Claims {
     Ok(decode::<Claims>(jwt, &key, &v)?)
   }
 
-  pub fn jwt(local_user_id: i32, jwt_secret: &str) -> Result<Jwt, LemmyError> {
+  pub fn jwt(local_user_id: i32, jwt_secret: &str, hostname: &str) -> Result<Jwt, LemmyError> {
     let my_claims = Claims {
       sub: local_user_id,
-      iss: Settings::get().hostname,
+      iss: hostname.to_string(),
       iat: Utc::now().timestamp(),
     };