Read DefaultAccess parameter from the configuration file correctly

This commit is contained in:
Alexander Bock
2019-05-22 22:28:30 -06:00
parent 01628578eb
commit 92cb443205
2 changed files with 30 additions and 24 deletions

View File

@@ -117,6 +117,19 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
_defaultAccess.addOption(static_cast<int>(Access::RequirePassword), RequirePassword);
_defaultAccess.addOption(static_cast<int>(Access::Allow), AllowAccess);
if (config.hasKey(DefaultAccessInfo.identifier)) {
std::string access = config.value<std::string>(DefaultAccessInfo.identifier);
if (access == DenyAccess) {
_defaultAccess.setValue(static_cast<int>(Access::Deny));
}
else if (access == RequirePassword) {
_defaultAccess.setValue(static_cast<int>(Access::RequirePassword));
}
else if (access == AllowAccess) {
_defaultAccess.setValue(static_cast<int>(Access::Allow));
}
}
const std::string identifier = config.value<std::string>(KeyIdentifier);
auto readList =
@@ -153,7 +166,7 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
_port = static_cast<int>(config.value<double>(PortInfo.identifier));
_enabled = config.value<bool>(EnabledInfo.identifier);
std::function<void()> reinitialize = [this]() {
auto reinitialize = [this]() {
deinitialize();
initialize();
};