#!/usr/bin/env bash

export UNIFI_GOAPP_BUILD_JSON="/usr/lib/unifi-credential-server/build.json"

source "/usr/lib/unifi-credential-server/scripts/envs.sh" || true

export UNIFI_GOAPP_DIR_WKDIR="${CREDENTIAL_WS_DIR}"
export UNIFI_GOAPP_DIR_LOG="${CREDENTIAL_LOG_DIR}"
export UNIFI_GOAPP_DIR_DATA="${CREDENTIAL_DATA_DIR}"

export UNIFI_GOAPP_USER_ASSETS_DIR_WKDIR="${USER_ASSETS_WS_DIR}"
export UNIFI_GOAPP_USER_ASSETS_DIR_LOG="${USER_ASSETS_LOG_DIR}"
export UNIFI_GOAPP_USER_ASSETS_DIR_DATA="${USER_ASSETS_DATA_DIR}"

export UNIFI_GOAPP_SCRIPT_EXTENSION="/usr/lib/unifi-credential-server/scripts/unifi-goapp-mgnt-extension.sh"
/usr/lib/unifi-credential-server/scripts/unifi-goapp-mgnt.sh $@

exit $?