aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-15 09:42:55 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-15 09:42:55 -0400
commit97624c22ea3e643e598af782c7f1f40aceeea970 (patch)
tree17420fb509b2baea279693a253565eabc447556f
parente2e1bdb7533a9b0e1f98e4792693da2702e5f9f2 (diff)
downloadstasis-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.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 40b5f71..e070911 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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));