1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Adapt Forez groups specification for Microservices

This commit is contained in:
Pierre HUBERT 2021-10-16 18:06:45 +02:00
parent b7a0208e71
commit c782f64602
2 changed files with 12 additions and 8 deletions

View File

@ -81,5 +81,4 @@ admin-url: http://localhost:3001
# This option allows to enable some extra features for these groups
#
# In most cases you should not have to specify this information
forez_groups:
- 32
forez_groups: 32

View File

@ -140,6 +140,16 @@ impl Config {
})
};
let forez_groups = match &parsed["forez_groups"] {
Yaml::BadValue => vec![],
_ => {
Self::yaml_str(parsed, "forez_groups")
.split(",")
.map(|f| GroupID::new(f.trim().parse::<u64>().unwrap()))
.collect()
}
};
let conf = Config {
port: Config::yaml_u64(parsed, "server-port"),
listen_address: Config::yaml_str(parsed, "server-address"),
@ -173,12 +183,7 @@ impl Config {
admin_url: Self::yaml_str(parsed, "admin-url"),
forez_groups: parsed["forez_groups"]
.as_vec()
.unwrap_or(&vec![])
.iter()
.map(|f| GroupID::new(f.as_i64().unwrap() as u64))
.collect(),
forez_groups,
};
// Save new configuration in memory