config split
This commit is contained in:
88
ci/scripts/check-config-coherence.sh
Executable file
88
ci/scripts/check-config-coherence.sh
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
fail() {
|
||||
echo "[config-coherence] $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_absent() {
|
||||
pattern="$1"
|
||||
shift
|
||||
if rg -n "${pattern}" "$@" >/tmp/sendico-config-check.out 2>/dev/null; then
|
||||
cat /tmp/sendico-config-check.out >&2
|
||||
fail "unexpected match for pattern: ${pattern}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_present() {
|
||||
pattern="$1"
|
||||
file="$2"
|
||||
if ! rg -n "${pattern}" "${file}" >/tmp/sendico-config-check.out 2>/dev/null; then
|
||||
fail "missing required pattern '${pattern}' in ${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_absent 'config\.dev\.yml:/app/config\.yml' docker-compose.dev.yml
|
||||
check_absent 'advertise_host: "dev-|address: dev-[^"]*:[0-9]+' api/**/config.dev.yml
|
||||
check_absent 'advertise_host: "sendico_|address: sendico_[^"]*:[0-9]+' api/**/config.local.yml
|
||||
|
||||
while IFS= read -r script; do
|
||||
[ -n "${script}" ] || continue
|
||||
check_present 'resolve_app_config_path' "${script}"
|
||||
sh -n "${script}"
|
||||
done <<'EOF'
|
||||
ci/scripts/aurora/build-image.sh
|
||||
ci/scripts/bff/build-image.sh
|
||||
ci/scripts/billing_documents/build-image.sh
|
||||
ci/scripts/billing_fees/build-image.sh
|
||||
ci/scripts/callbacks/build-image.sh
|
||||
ci/scripts/chain_gateway/build-image.sh
|
||||
ci/scripts/chsettle/build-image.sh
|
||||
ci/scripts/discovery/build-image.sh
|
||||
ci/scripts/fx/build-image.sh
|
||||
ci/scripts/ledger/build-image.sh
|
||||
ci/scripts/mntx/build-image.sh
|
||||
ci/scripts/notification/build-image.sh
|
||||
ci/scripts/payments_methods/build-image.sh
|
||||
ci/scripts/payments_orchestrator/build-image.sh
|
||||
ci/scripts/payments_quotation/build-image.sh
|
||||
ci/scripts/tgsettle/build-image.sh
|
||||
ci/scripts/tron_gateway/build-image.sh
|
||||
EOF
|
||||
|
||||
sh -n ci/scripts/common/runtime_env.sh
|
||||
|
||||
while IFS= read -r dockerfile; do
|
||||
[ -n "${dockerfile}" ] || continue
|
||||
check_present 'ARG APP_CONFIG_PATH=' "${dockerfile}"
|
||||
check_present 'COPY \$\{APP_CONFIG_PATH\} /app/config.yml' "${dockerfile}"
|
||||
done <<'EOF'
|
||||
ci/prod/compose/aurora_gateway.dockerfile
|
||||
ci/prod/compose/bff.dockerfile
|
||||
ci/prod/compose/billing_documents.dockerfile
|
||||
ci/prod/compose/billing_fees.dockerfile
|
||||
ci/prod/compose/callbacks.dockerfile
|
||||
ci/prod/compose/chain_gateway.dockerfile
|
||||
ci/prod/compose/chsettle_gateway.dockerfile
|
||||
ci/prod/compose/discovery.dockerfile
|
||||
ci/prod/compose/fx_ingestor.dockerfile
|
||||
ci/prod/compose/fx_oracle.dockerfile
|
||||
ci/prod/compose/ledger.dockerfile
|
||||
ci/prod/compose/mntx_gateway.dockerfile
|
||||
ci/prod/compose/notification.dockerfile
|
||||
ci/prod/compose/payments_methods.dockerfile
|
||||
ci/prod/compose/payments_orchestrator.dockerfile
|
||||
ci/prod/compose/payments_quotation.dockerfile
|
||||
ci/prod/compose/tgsettle_gateway.dockerfile
|
||||
ci/prod/compose/tron_gateway.dockerfile
|
||||
EOF
|
||||
|
||||
if command -v docker >/dev/null 2>&1 && [ -f .env.dev ]; then
|
||||
docker compose -f docker-compose.dev.yml --env-file .env.dev config >/tmp/sendico-config-check-compose.out
|
||||
fi
|
||||
|
||||
echo "[config-coherence] OK"
|
||||
Reference in New Issue
Block a user