Secure session key is now in configuration.

This commit is contained in:
2023-12-26 19:50:29 +01:00
parent f3d6e0ea5b
commit 0d4b4a0b3d
3 changed files with 22 additions and 2 deletions
+17
View File
@@ -14,6 +14,19 @@ pub struct Network {
port: u16
}
#[cfg(feature = "ssr")]
#[derive(Deserialize)]
pub struct Session {
key: String
}
#[cfg(feature = "ssr")]
impl Session {
pub fn key(&self) -> &[u8] {
self.key.as_bytes()
}
}
#[cfg(feature = "ssr")]
impl Network {
pub fn bind_address(&self) -> SocketAddr {
@@ -41,12 +54,16 @@ impl Database {
#[cfg(feature = "ssr")]
#[derive(Deserialize)]
pub struct Configuration {
session: Session,
network: Network,
database: Database
}
#[cfg(feature = "ssr")]
impl Configuration {
pub fn session(&self) -> &Session {
&self.session
}
pub fn network(&self) -> &Network {
&self.network
}