18 lines
500 B
Bash
18 lines
500 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
secret_file="${BACKEND_API_KEY_FILE:-/run/secrets/backend_api_key}"
|
|
if [ ! -r "$secret_file" ]; then
|
|
echo "백엔드 인증 키 파일을 읽을 수 없습니다." >&2
|
|
exit 1
|
|
fi
|
|
|
|
backend_api_key="$(cat "$secret_file")"
|
|
if [ -z "$backend_api_key" ]; then
|
|
echo "백엔드 인증 키가 비어 있습니다." >&2
|
|
exit 1
|
|
fi
|
|
|
|
escaped_key="$(printf '%s' "$backend_api_key" | sed 's/[\\/&]/\\\\&/g')"
|
|
sed -i "s/__BACKEND_API_KEY__/${escaped_key}/g" /etc/nginx/conf.d/default.conf
|