1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

remove lazy_static

This commit is contained in:
Rob Ede 2022-09-11 16:14:07 +01:00
parent ed04cc97b3
commit fc0486dd4a
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
4 changed files with 8 additions and 8 deletions

2
Cargo.lock generated
View File

@ -5779,7 +5779,7 @@ dependencies = [
"diesel",
"dotenv",
"env_logger 0.9.0",
"lazy_static",
"once_cell",
"r2d2",
"rust-argon2",
"serde",

View File

@ -12,9 +12,9 @@ derive_more = "0.99.5"
diesel = { version = "2", features = ["postgres", "r2d2", "uuid", "chrono"] }
dotenv = "0.15"
env_logger = "0.9"
once_cell = "1"
r2d2 = "0.8"
rust-argon2 = "1"
lazy_static = "1.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sparkpost = "0.5"

View File

@ -1,12 +1,12 @@
use once_cell::sync::Lazy;
use sparkpost::transmission::{
EmailAddress, Message, Options, Recipient, Transmission, TransmissionResponse,
};
use crate::{errors::ServiceError, models::Invitation};
lazy_static::lazy_static! {
static ref API_KEY: String = std::env::var("SPARKPOST_API_KEY").expect("SPARKPOST_API_KEY must be set");
}
static API_KEY: Lazy<String> =
Lazy::new(|| std::env::var("SPARKPOST_API_KEY").expect("SPARKPOST_API_KEY must be set"));
pub fn send_invitation(invitation: &Invitation) -> Result<(), ServiceError> {
let tm = Transmission::new_eu(API_KEY.as_str());

View File

@ -1,10 +1,10 @@
use argon2::{self, Config};
use once_cell::sync::Lazy;
use crate::errors::ServiceError;
lazy_static::lazy_static! {
pub static ref SECRET_KEY: String = std::env::var("SECRET_KEY").unwrap_or_else(|_| "0123".repeat(8));
}
pub static SECRET_KEY: Lazy<String> =
Lazy::new(|| std::env::var("SECRET_KEY").unwrap_or_else(|_| "0123".repeat(8)));
const SALT: &[u8] = b"supersecuresalt";