Private
Public Access
1
0

daemon: Token store

This commit is contained in:
2025-04-27 14:01:19 -07:00
parent 84f782cc03
commit 49f8b81b9c
8 changed files with 51 additions and 26 deletions

View File

@@ -8,7 +8,7 @@ pub use tokio::sync::Mutex;
use crate::repository::Repository;
use crate::settings::Settings;
pub use kordophone::api::TokenManagement;
pub use kordophone::api::TokenStore;
use kordophone::model::JwtToken;
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
@@ -89,7 +89,8 @@ impl DatabaseAccess for Arc<Mutex<Database>> {
static TOKEN_KEY: &str = "token";
impl TokenManagement for Database {
#[async_trait]
impl TokenStore for Database {
async fn get_token(&mut self) -> Option<JwtToken> {
self.with_settings(|settings| {
let token: Result<Option<JwtToken>> = settings.get(TOKEN_KEY);