From 46b1f17ddf3d0273826ab79be0a6f3352fcb684b Mon Sep 17 00:00:00 2001 From: Henry Lee Date: Sat, 20 Jul 2024 21:08:22 +0800 Subject: [PATCH] build(docker): create fernet key if not exists --- entrypoint.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 623fc39..f2938d1 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,11 +10,10 @@ fi # Create Fernet key if not exists if [ -z "${AIRFLOW__CORE__FERNET_KEY}" ]; then - echo "Fernet key not set" - echo "Please use the following command to generate" - echo "And set the key to AIRFLOW__CORE__FERNET_KEY environment variable" - echo ">> python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'" - exit 1 + echo "Fernet key not set. Generating a new one." + export AIRFLOW__CORE__FERNET_KEY=$(python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())') + echo "Fernet key generated and set." + echo "[WARNING] Please save the AIRFLOW__CORE__FERNET_KEY for future use." else echo "Fernet key exists." fi