Skip to content

Commit

Permalink
init: support other locations for krun_config
Browse files Browse the repository at this point in the history
So far, the configuration was always expected to be in
"/.krun_config.json". To support it to be located elsewhere, use the
path stored in KRUN_CONFIG, falling back to the original location if not
found there.

Signed-off-by: Sergio Lopez <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
  • Loading branch information
slp committed Sep 27, 2024
1 parent 240ea96 commit 33a1f3d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ static int config_parse_file(char ***argv, char **workdir)
jsmntok_t *tokens;
struct stat stat;
char *data;
char *config_file;
char **config_argv;
char **entrypoint;
int parsed_env, parsed_workdir, parsed_args, parsed_entrypoint;
Expand All @@ -582,7 +583,12 @@ static int config_parse_file(char ***argv, char **workdir)
int fd;
int i;

fd = open(CONFIG_FILE_PATH, O_RDONLY);
config_file = getenv("KRUN_CONFIG");
if (!config_file) {
config_file = CONFIG_FILE_PATH;
}

fd = open(config_file, O_RDONLY);
if (fd < 0) {
return ret;
}
Expand Down

0 comments on commit 33a1f3d

Please sign in to comment.