-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathentrypoint.sh
More file actions
35 lines (30 loc) · 1.04 KB
/
entrypoint.sh
File metadata and controls
35 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Exit script on first error
set -e
# Check if the AIRFLOW_HOME variable is set
if [ -z "${AIRFLOW_HOME}" ]; then
echo 'AIRFLOW_HOME not set'
exit 1
fi
# Create Fernet key if not exists
if [ -z "${AIRFLOW__CORE__FERNET_KEY}" ]; then
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
# Check if the GCP service account is provided
if [ -z "${GOOGLE_APPLICATION_CREDENTIALS}" ]; then
echo "No GCP service account provided, set to default path"
export GOOGLE_APPLICATION_CREDENTIALS="${AIRFLOW_HOME}/service-account.json"
fi
# Check if the command is provided
if [ -z "$1" ]; then
echo "No command provided. Usage: $0 {airflow_command}"
exit 1
fi
# Execute the provided Airflow command
echo "Running command: airflow $@"
exec airflow "$@"