Secure session key is now in configuration.
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
[session]
|
||||||
|
key = '------------- Secure session key, 64 character length -------------'
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
bind_ip = '127.0.0.1'
|
bind_ip = '127.0.0.1'
|
||||||
port = 3000
|
port = 3000
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ pub struct Network {
|
|||||||
port: u16
|
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")]
|
#[cfg(feature = "ssr")]
|
||||||
impl Network {
|
impl Network {
|
||||||
pub fn bind_address(&self) -> SocketAddr {
|
pub fn bind_address(&self) -> SocketAddr {
|
||||||
@@ -41,12 +54,16 @@ impl Database {
|
|||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Configuration {
|
pub struct Configuration {
|
||||||
|
session: Session,
|
||||||
network: Network,
|
network: Network,
|
||||||
database: Database
|
database: Database
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
impl Configuration {
|
impl Configuration {
|
||||||
|
pub fn session(&self) -> &Session {
|
||||||
|
&self.session
|
||||||
|
}
|
||||||
pub fn network(&self) -> &Network {
|
pub fn network(&self) -> &Network {
|
||||||
&self.network
|
&self.network
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
use log::error;
|
use log::{debug, error};
|
||||||
use rezervator::backend::company::check_company;
|
use rezervator::backend::company::check_company;
|
||||||
use rezervator::backend::user::create_admin;
|
use rezervator::backend::user::create_admin;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
let srv_conf = load_config(&cfg_path);
|
let srv_conf = load_config(&cfg_path);
|
||||||
// Generate the list of routes in your Leptos App
|
// Generate the list of routes in your Leptos App
|
||||||
let routes = generate_route_list(|| view! { <App/> });
|
let routes = generate_route_list(|| view! { <App/> });
|
||||||
let key = Key::generate();
|
let key = Key::from(srv_conf.session().key());
|
||||||
|
|
||||||
let pool = PgPoolOptions::new()
|
let pool = PgPoolOptions::new()
|
||||||
.max_connections(10)
|
.max_connections(10)
|
||||||
|
|||||||
Reference in New Issue
Block a user