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
1 changed files with 3 additions and 2 deletions

View File

@ -9,7 +9,7 @@ pub const PAYLOAD_LIMIT: usize = 10_000_000;
pub const PROXY_TIMEOUT: u64 = 15;
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 NAME_LIST_FILE: &str = "./name-list.txt";
@ -49,6 +49,7 @@ pub struct Config {
pub admin_password: String,
pub prune_days: u16,
pub debug_mode: bool,
pub cookie_key: String,
pub config_version: u8,
}
@ -64,7 +65,7 @@ impl Config {
conffile
.read_to_string(&mut confstr)
.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,