diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-14 10:05:58 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-14 10:05:58 -0500 |
commit | 1762aa42cd86e0bb2631631488bf8b2474378f83 (patch) | |
tree | 210c031a88ed9c439b8faa9b21828eee67e154d7 /src/lib/entrypoint/entrypoint_callbacks.c | |
parent | 014eb7d96a55067aec4c6b81cf50072f90df5b5f (diff) | |
download | stasis-1762aa42cd86e0bb2631631488bf8b2474378f83.tar.gz |
Move cli/stasis main program to a library stasis_entrypoint.a
Diffstat (limited to 'src/lib/entrypoint/entrypoint_callbacks.c')
-rw-r--r-- | src/lib/entrypoint/entrypoint_callbacks.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/entrypoint/entrypoint_callbacks.c b/src/lib/entrypoint/entrypoint_callbacks.c new file mode 100644 index 0000000..502d36b --- /dev/null +++ b/src/lib/entrypoint/entrypoint_callbacks.c @@ -0,0 +1,31 @@ +#include "entrypoint_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; +} + |