src/server/daemon/configmanager.c

changeset 443
ef3c8a0e1fee
parent 440
d77b8f3e14e2
equal deleted inserted replaced
442:05c2b62448b1 443:ef3c8a0e1fee
54 int cfgmgr_load_config(CfgManager *mgr) { 54 int cfgmgr_load_config(CfgManager *mgr) {
55 ZERO(mgr, sizeof(CfgManager)); 55 ZERO(mgr, sizeof(CfgManager));
56 ServerConfiguration *config = load_server_conf(mgr, "config/server.conf"); 56 ServerConfiguration *config = load_server_conf(mgr, "config/server.conf");
57 57
58 if(!config) { 58 if(!config) {
59 return -1; 59 log_ereport(LOG_FAILURE, "cfgmgr: cannot load server config file %s", "config/server.conf");
60 return 1;
60 } 61 }
61 62
62 mgr->cfg = config; 63 mgr->cfg = config;
63 64
64 return 0; 65 return 0;
65 } 66 }
66 67
67 int cfgmgr_apply_config(CfgManager *mgr) { 68 int cfgmgr_apply_config(CfgManager *mgr) {
68 // stage 2 config loading 69 // stage 2 config loading
69 if(!apply_server_conf(mgr)) { 70 if(!apply_server_conf(mgr)) {
71 log_ereport(LOG_FAILURE, "cfgmgr: stage 2 config loading failed");
70 return 1; 72 return 1;
71 } 73 }
72 74
73 // some extra steps required if there is already a configuration loaded 75 // some extra steps required if there is already a configuration loaded
74 if(current_config) { 76 if(current_config) {
75 if(migrate_server_conf(current_config, mgr->cfg)) { 77 if(migrate_server_conf(current_config, mgr->cfg)) {
78 log_ereport(LOG_FAILURE, "cfgmgr: config migration failed");
76 return 1; 79 return 1;
77 } 80 }
78 81
79 cfg_unref(current_config); 82 cfg_unref(current_config);
80 } 83 }

mercurial