X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fconfig.cpp;h=164e0bbadef6e43eb989ddfad665833bfc4594a9;hb=25c0504e3788f510af63125fc7e3c03dc8302e9c;hp=9dfb112a5107836cf43fe2755328fc999794fa6d;hpb=d19fbcd86a265cb99dd8597430e8159e9403c743;p=cassiopeia.git diff --git a/src/config.cpp b/src/config.cpp index 9dfb112..164e0bb 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -13,15 +13,17 @@ std::unordered_map profiles; std::unordered_map> CAs; std::string sqlHost, sqlUser, sqlPass, sqlDB; std::string serialPath; +std::string crlPrefix; +std::string crtPrefix; std::shared_ptr> parseConf( std::string path ) { - std::shared_ptr> map( new std::unordered_map() ); + auto map = std::make_shared>(); std::ifstream config; config.open( path ); if( !config.is_open() ) { logger::notef( "Where is \"%s\"?", path ); - throw "Config missing"; + throw std::runtime_error("Config missing"); } std::string line1; @@ -105,7 +107,7 @@ int parseProfiles() { } if( CAs.find( caName ) == CAs.end() ) { - std::shared_ptr ca( new CAConfig( caName ) ); + auto ca = std::make_shared( caName ); CAs.emplace( caName, ca ); } @@ -115,7 +117,7 @@ int parseProfiles() { closedir( dir ); } else { - throw "Directory with CAConfigs not found"; + throw std::runtime_error("Directory with CAConfigs not found"); } profiles.emplace( profileName, prof ); @@ -130,7 +132,6 @@ int parseProfiles() { } int parseConfig( std::string path ) { - auto masterConf = parseConf( path ); keyDir = masterConf->at( "key.directory" ); @@ -139,6 +140,8 @@ int parseConfig( std::string path ) { sqlPass = masterConf->at( "sql.password" ); sqlDB = masterConf->at( "sql.database" ); serialPath = masterConf->at( "serialPath" ); + crlPrefix = masterConf->at( "crlPrefix" ); + crtPrefix = masterConf->at( "crtPrefix" ); if( keyDir == "" ) { logger::error( "Missing config property key.directory" );