| 56 | Sapphire::Common::Config::ApiConfig m_config; |
| 57 | |
| 58 | void reloadConfig() |
| 59 | { |
| 60 | auto pConfig = std::make_shared< Sapphire::Common::ConfigMgr >(); |
| 61 | |
| 62 | Logger::info( "Loading config " + configPath ); |
| 63 | |
| 64 | bool failedLoad = false; |
| 65 | |
| 66 | // load global cfg first |
| 67 | if( !pConfig->loadGlobalConfig( m_config.global ) ) |
| 68 | { |
| 69 | Logger::fatal( "Error loading config global.ini" ); |
| 70 | failedLoad = true; |
| 71 | } |
| 72 | |
| 73 | if( !pConfig->loadConfig( configPath ) ) |
| 74 | { |
| 75 | Logger::fatal( "Error loading config {0}", configPath ); |
| 76 | failedLoad = true; |
| 77 | } |
| 78 | |
| 79 | if( failedLoad ) |
| 80 | { |
| 81 | Logger::fatal( "If this is the first time starting the server, we've copied the default configs for your editing pleasure." ); |
| 82 | throw "Error loading config"; |
| 83 | } |
| 84 | |
| 85 | // setup api config |
| 86 | m_config.network.listenPort = pConfig->getValue< uint16_t >( "Network", "ListenPort", 80 ); |
| 87 | m_config.network.listenIP = pConfig->getValue< std::string >( "Network", "ListenIp", "0.0.0.0" ); |
| 88 | } |
| 89 | |
| 90 | void print_request_info( shared_ptr< HttpServer::Request > request ) |
| 91 | { |
no test coverage detected