diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-14 12:21:32 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-14 12:21:32 -0400 |
commit | 26000fb8e6cc08c227d4463de60e28881179e5cb (patch) | |
tree | 48978ff793f2a969df196cfa7700100e5c82a2f5 /src/cli/stasis/callbacks.c | |
parent | a29bca4b79f19e9f04420b545bdec27ddc99150c (diff) | |
download | stasis-restructure-the-world.tar.gz |
Reduce length of stasis_main.crestructure-the-world
Diffstat (limited to 'src/cli/stasis/callbacks.c')
-rw-r--r-- | src/cli/stasis/callbacks.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/cli/stasis/callbacks.c b/src/cli/stasis/callbacks.c new file mode 100644 index 0000000..aeaa25d --- /dev/null +++ b/src/cli/stasis/callbacks.c @@ -0,0 +1,31 @@ +#include "callbacks.h" + +int callback_except_jf(const void *a, const void *b) { + const struct EnvCtl_Item *item = a; + const char *name = b; + + if (!globals.enable_artifactory) { + return STASIS_ENVCTL_RET_IGNORE; + } + + if (envctl_check_required(item->flags)) { + const char *content = getenv(name); + if (!content || isempty((char *) content)) { + return STASIS_ENVCTL_RET_FAIL; + } + } + + return STASIS_ENVCTL_RET_SUCCESS; +} + +int callback_except_gh(const void *a, const void *b) { + const struct EnvCtl_Item *item = a; + const char *name = b; + //printf("GH exception check: %s\n", name); + if (envctl_check_required(item->flags) && envctl_check_present(item, name)) { + return STASIS_ENVCTL_RET_SUCCESS; + } + + return STASIS_ENVCTL_RET_FAIL; +} + |