diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 09:42:55 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 09:42:55 -0400 |
commit | 97624c22ea3e643e598af782c7f1f40aceeea970 (patch) | |
tree | 17420fb509b2baea279693a253565eabc447556f | |
parent | e2e1bdb7533a9b0e1f98e4792693da2702e5f9f2 (diff) | |
download | stasis-97624c22ea3e643e598af782c7f1f40aceeea970.tar.gz |
Use the installed version of the omc.ini configuration file when no path is passed to the program via -c/--config
-rw-r--r-- | src/main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -323,9 +323,17 @@ int main(int argc, char *argv[]) { ctx.meta.python_compact = to_short_version(ctx.meta.python); } + if (!config_input) { + // no configuration passed by argument. use basic config. + char cfgfile[PATH_MAX * 2]; + sprintf(cfgfile, "%s/%s", globals.sysconfdir, "omc.ini"); + if (!access(cfgfile, F_OK)) { + config_input = strdup(cfgfile); + } + } + if (config_input) { msg(OMC_MSG_L2, "Reading OMC global configuration: %s\n", config_input); - ctx._omc_ini_fp.cfg = ini_open(config_input); if (!ctx._omc_ini_fp.cfg) { msg(OMC_MSG_ERROR | OMC_MSG_L2, "Failed to read config file: %s, %s\n", delivery_input, strerror(errno)); |