use key from config

This commit is contained in:
azdle 2025-07-23 13:31:15 -05:00
parent b6111fb8fa
commit 233968fa97
6 changed files with 8 additions and 2 deletions

3
Cargo.lock generated
View file

@ -575,8 +575,10 @@ checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
dependencies = [ dependencies = [
"aes-gcm", "aes-gcm",
"base64 0.22.1", "base64 0.22.1",
"hkdf",
"percent-encoding", "percent-encoding",
"rand 0.8.5", "rand 0.8.5",
"sha2",
"subtle", "subtle",
"time", "time",
"version_check", "version_check",
@ -4268,6 +4270,7 @@ dependencies = [
"axum-extra", "axum-extra",
"bollard", "bollard",
"config", "config",
"cookie",
"futures-util", "futures-util",
"http-body-util", "http-body-util",
"hyper", "hyper",

View file

@ -15,6 +15,7 @@ askama_web = { version = "0.14.4", features = ["axum-0.8"] }
axum = { version = "0.8", features = ["tokio", "http1", "http2", "macros"] } axum = { version = "0.8", features = ["tokio", "http1", "http2", "macros"] }
axum-extra = { version = "0.10", features = ["cookie-private", "typed-header"] } axum-extra = { version = "0.10", features = ["cookie-private", "typed-header"] }
config = { version = "0.15", features = ["toml"] } config = { version = "0.15", features = ["toml"] }
cookie = { version = "0.18.1", features = ["key-expansion"] }
futures-util = "0.3" futures-util = "0.3"
hyper = "1.1" hyper = "1.1"
lettre = { version = "0.11.17", features = ["tokio1", "tokio1-native-tls", "tracing", "web"] } lettre = { version = "0.11.17", features = ["tokio1", "tokio1-native-tls", "tracing", "web"] }

View file

@ -1,5 +1,6 @@
[app] [app]
listen = "[::]:3742" listen = "[::]:3742"
key = "Q^,zH6M}*JY-W[oWCn6T7W!G=TvN,a5[~%cfRKZ7jse1EMDgG7GdTFy)ez*E(9I"
[email] [email]
server = "smtp.fastmail.com" server = "smtp.fastmail.com"

View file

@ -12,6 +12,7 @@ pub struct Database {
pub struct App { pub struct App {
pub listen: SocketAddr, pub listen: SocketAddr,
pub public_url: String, pub public_url: String,
pub key: String,
} }
#[derive(Debug, Deserialize, Clone)] #[derive(Debug, Deserialize, Clone)]

View file

@ -55,8 +55,7 @@ impl ZeroToAxum {
let app_state = AppState { let app_state = AppState {
conf: Arc::new(conf.clone()), conf: Arc::new(conf.clone()),
// TODO: pull from config key: Key::derive_from(conf.app.key.as_bytes()),
key: Key::generate(),
db, db,
email_client, email_client,
}; };

View file

@ -49,6 +49,7 @@ impl TestServer {
listen: "[::]:0".parse().unwrap(), listen: "[::]:0".parse().unwrap(),
// TODO: how do I both configure this and use a random port? // TODO: how do I both configure this and use a random port?
public_url: "http://localhost/".to_string(), public_url: "http://localhost/".to_string(),
key: "Q^,zH6M}*JY-W[oWCn6T7W!G=TvN,a5[~%cfRKZ7jse1EMDgG7GdTFy)ez*E(9I".to_string(),
}, },
database: conf::Database { url }, database: conf::Database { url },
debug: true, debug: true,