This commit is contained in:
naskya 2024-06-20 23:56:43 +09:00
parent 0f8933e259
commit ad7cd98d85
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -289,7 +289,7 @@ fn create_new_server_config(
network: server::Network {
protocol: match protocol.as_str() {
"http" => Some(server::HttpProtocol::Http),
_ => Some(server::HttpProtocol::Https),
_ => None,
},
host,
port: default_yml
@ -342,20 +342,21 @@ fn create_new_server_config(
None => None,
},
password: match redis.get(&Yaml::String("pass".to_string())) {
Some(user) => Some(
user.as_str()
Some(pass) => Some(
pass.as_str()
.ok_or(Error::InvalidConfig("redis.pass"))?
.to_string(),
),
None => None,
},
index: match redis.get(&Yaml::String("db".to_string())) {
Some(user) => Some(user.as_i64().ok_or(Error::InvalidConfig("redis.db"))? as u8),
Some(db) => Some(db.as_i64().ok_or(Error::InvalidConfig("redis.db"))? as u8),
None => None,
},
prefix: match redis.get(&Yaml::String("prefix".to_string())) {
Some(user) => Some(
user.as_str()
Some(prefix) => Some(
prefix
.as_str()
.ok_or(Error::InvalidConfig("redis.prefix"))?
.to_string(),
),
@ -375,8 +376,8 @@ fn create_new_server_config(
None => None,
},
fingerprint: match id.get(&Yaml::String("fingerprint".to_string())) {
Some(length) => Some(
length
Some(fingerprint) => Some(
fingerprint
.as_str()
.ok_or(Error::InvalidConfig("cuid.fingerprint"))?
.to_string(),