Files
xinfra/scripts/run-server-postgresql-local.sh

30 lines
827 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
REPO_ROOT=$(cd -- "${SCRIPT_DIR}/.." && pwd)
CONFIG_FILE=${1:-"${REPO_ROOT}/config/local/server-postgresql.env"}
[[ -f ${CONFIG_FILE} ]] || {
printf 'error: configuration file not found: %s\n' "${CONFIG_FILE}" >&2
exit 1
}
set -a
# shellcheck disable=SC1090
source "${CONFIG_FILE}"
set +a
if [[ -z ${AWX_TOKEN:-} && -z ${AWX_PASSWORD:-} ]]; then
AWX_K8S_NAMESPACE=${AWX_K8S_NAMESPACE:-awx}
AWX_K8S_ADMIN_PASSWORD_SECRET=${AWX_K8S_ADMIN_PASSWORD_SECRET:-awx-demo-admin-password}
AWX_PASSWORD=$(kubectl get secret \
-n "${AWX_K8S_NAMESPACE}" "${AWX_K8S_ADMIN_PASSWORD_SECRET}" \
-o jsonpath='{.data.password}' | base64 --decode)
export AWX_PASSWORD
fi
cd "${REPO_ROOT}/server"
exec go run ./cmd/server