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