Refactored logging message

This commit is contained in:
Thorsten Sommer 2024-11-05 21:10:31 +01:00
parent d96b168ee6
commit 1024c1de71
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,4 @@
use log::info;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rand::{RngCore, SeedableRng}; use rand::{RngCore, SeedableRng};
use rocket::http::Status; use rocket::http::Status;
@ -8,7 +9,11 @@ pub static API_TOKEN: Lazy<APIToken> = Lazy::new(|| {
let mut token = [0u8; 32]; let mut token = [0u8; 32];
let mut rng = rand_chacha::ChaChaRng::from_entropy(); let mut rng = rand_chacha::ChaChaRng::from_entropy();
rng.fill_bytes(&mut token); rng.fill_bytes(&mut token);
APIToken::from_bytes(token.to_vec())
let token = APIToken::from_bytes(token.to_vec());
info!("API token was generated successfully.");
token
}); });
pub struct APIToken { pub struct APIToken {

View File

@ -37,6 +37,7 @@ pub static ENCRYPTION: Lazy<Encryption> = Lazy::new(|| {
rng.fill_bytes(&mut secret_key); rng.fill_bytes(&mut secret_key);
rng.fill_bytes(&mut secret_key_salt); rng.fill_bytes(&mut secret_key_salt);
info!("Secret password for the IPC channel was generated successfully.");
Encryption::new(&secret_key, &secret_key_salt).unwrap() Encryption::new(&secret_key, &secret_key_salt).unwrap()
}); });

View File

@ -139,8 +139,7 @@ async fn main() {
.ignite().await.unwrap() .ignite().await.unwrap()
.launch().await.unwrap(); .launch().await.unwrap();
}); });
info!("Secret password for the IPC channel was generated successfully.");
start_dotnet_server(*API_SERVER_PORT); start_dotnet_server(*API_SERVER_PORT);
start_tauri(); start_tauri();
} }