Files
backend/bin/config-push
2024-07-26 20:09:19 -04:00

49 lines
873 B
Bash
Executable File

#!/bin/bash
if [ "$1" == "" ]; then
echo 'usage: config-push {config_name} [secret_name]'
exit 1
fi
CONFIG=$1
shift
if [ "$1" != "" ]; then
KEY=backend-$1
else
KEY=backend
fi
DEXO="conf/dexorder-$CONFIG.toml"
if [ ! -f "$DEXO" ]; then
DEXO="conf/$CONFIG/dexorder-$CONFIG.toml"
fi
if [ ! -f "$DEXO" ]; then
DEXO=
else
DEXO="--from-file dexorder.toml=$DEXO"
fi
LOG="conf/logging-$CONFIG.toml"
if [ ! -f "$LOG" ]; then
LOG="conf/$CONFIG/logging-$CONFIG.toml"
fi
if [ ! -f "$LOG" ]; then
LOG=
else
LOG="--from-file logging.toml=$LOG"
fi
META="conf/metadata-$CONFIG.json"
if [ ! -f "$META" ]; then
META="conf/$CONFIG/metadata-$CONFIG.json"
fi
if [ ! -f "$META" ]; then
META=
else
META="--from-file metadata.json=$META"
fi
# shellcheck disable=SC2086
kubectl create configmap "$KEY" $DEXO $LOG $META --dry-run=client -o yaml | kubectl apply -f -