]> WPIA git - cassiopeia.git/blobdiff - src/config.cpp
fmt: run format script excluding lambdas
[cassiopeia.git] / src / config.cpp
index acdaafbe8faea60a58b97ccb8d6b8178edd817eb..d078179cee5c8c47c6e0aba45bbe62987f9a9a60 100644 (file)
@@ -13,6 +13,8 @@ std::unordered_map<std::string, Profile> profiles;
 std::unordered_map<std::string, std::shared_ptr<CAConfig>> CAs;
 std::string sqlHost, sqlUser, sqlPass, sqlDB;
 std::string serialPath;
+std::string crlPrefix;
+std::string crtPrefix;
 
 std::shared_ptr<std::unordered_map<std::string, std::string>> parseConf( std::string path ) {
     auto map = std::make_shared<std::unordered_map<std::string, std::string>>();
@@ -21,7 +23,7 @@ std::shared_ptr<std::unordered_map<std::string, std::string>> parseConf( std::st
 
     if( !config.is_open() ) {
         logger::notef( "Where is \"%s\"?", path );
-        throw "Config missing";
+        throw std::runtime_error( "Config missing" );
     }
 
     std::string line1;
@@ -51,8 +53,8 @@ std::shared_ptr<std::unordered_map<std::string, std::string>> parseConf( std::st
 int parseProfiles() {
     CAs = std::unordered_map<std::string, std::shared_ptr<CAConfig>>();
 
-    DIRdp;
-    struct direntep;
+    DIR *dp;
+    struct dirent *ep;
     dp = opendir( "profiles" );
 
     if( dp == NULL ) {
@@ -93,8 +95,8 @@ int parseProfiles() {
 
         std::string cas = map->at( "ca" );
 
-        DIRdir;
-        struct direntent;
+        DIR *dir;
+        struct dirent *ent;
 
         if( ( dir = opendir( "ca" ) ) != NULL ) {
             while( ( ent = readdir( dir ) ) != NULL ) {
@@ -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 );
@@ -138,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" );