1
0
Fork 0
mirror of https://git.42l.fr/neil/sncf.git synced 2024-05-03 06:23:11 +02:00

adding cookie_key field, better error message on outdated config. bump cfg version

This commit is contained in:
neil 2020-11-03 19:05:08 +01:00
parent 6bfd488036
commit 151ad7b5aa

View file

@ -9,7 +9,7 @@ pub const PAYLOAD_LIMIT: usize = 10_000_000;
pub const PROXY_TIMEOUT: u64 = 15; pub const PROXY_TIMEOUT: u64 = 15;
pub const CONFIG_FILE: &str = "./config.toml"; pub const CONFIG_FILE: &str = "./config.toml";
pub const CONFIG_VERSION: u8 = 1; pub const CONFIG_VERSION: u8 = 2;
pub const ADJ_LIST_FILE: &str = "./adj-list.txt"; pub const ADJ_LIST_FILE: &str = "./adj-list.txt";
pub const NAME_LIST_FILE: &str = "./name-list.txt"; pub const NAME_LIST_FILE: &str = "./name-list.txt";
@ -49,6 +49,7 @@ pub struct Config {
pub admin_password: String, pub admin_password: String,
pub prune_days: u16, pub prune_days: u16,
pub debug_mode: bool, pub debug_mode: bool,
pub cookie_key: String,
pub config_version: u8, pub config_version: u8,
} }
@ -64,7 +65,7 @@ impl Config {
conffile conffile
.read_to_string(&mut confstr) .read_to_string(&mut confstr)
.expect("Couldn't read config to string"); .expect("Couldn't read config to string");
toml::from_str(&confstr).expect("Couldn't deserialize the config") toml::from_str(&confstr).expect("Couldn't deserialize the config. Please update at https://git.42l.fr/neil/sncf/wiki/Upgrade-from-a-previous-version --- Error")
} }
// if config.config_version doesn't match the hardcoded version, // if config.config_version doesn't match the hardcoded version,