feat: load cookie secret in settings
This commit is contained in:
parent
64a7e2e670
commit
92b83365e4
|
@ -1 +1,3 @@
|
|||
export POSTGRES_DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"
|
||||
export POSTGRES_DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"
|
||||
export FORGEFLUX_server_COOKIE_SECRET=""
|
||||
|
|
|
@ -13,6 +13,7 @@ port = 7000
|
|||
ip= "0.0.0.0"
|
||||
# enter your hostname, eg: example.com
|
||||
domain = "localhost:7000"
|
||||
#cookie_secret = ""
|
||||
|
||||
[database]
|
||||
# This section deals with the database location and how to access it
|
||||
|
|
|
@ -7,6 +7,7 @@ pub struct Server {
|
|||
pub port: u32,
|
||||
pub domain: String,
|
||||
pub ip: String,
|
||||
pub cookie_secret: String,
|
||||
}
|
||||
|
||||
impl Server {
|
||||
|
@ -18,6 +19,7 @@ impl Server {
|
|||
for (parameter, env_var_name) in [
|
||||
("server.port", "PORT"),
|
||||
("server.domain", "FORGEFLUX_server_DOMAIN"),
|
||||
("server.cookie_secret", "FORGEFLUX_server_COOKIE_SECRET"),
|
||||
("server.ip", "FORGEFLUX_server_IP"),
|
||||
]
|
||||
.iter()
|
||||
|
@ -49,5 +51,11 @@ mod tests {
|
|||
server.domain
|
||||
);
|
||||
env_helper!(init_settings, "FORGEFLUX_server_IP", "1.1.1.1", server.ip);
|
||||
env_helper!(
|
||||
init_settings,
|
||||
"FORGEFLUX_server_COOKIE_SECRET",
|
||||
"asdfasdflkjhasdlkfhalksdf",
|
||||
server.cookie_secret
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue