Skip to content
Discussion options

You must be logged in to vote

Never in the DAG file. Two safe options, and they are used for slightly different reasons:

Airflow connection (preferred for this project). Store the key as the password (or in the extra field) of the HTTP connection the DAG uses. Airflow encrypts connection secrets with its Fernet key, the value never touches your working tree, and the same DAG code then works unchanged in production where the connection is provisioned by whatever secrets backend you use.

.env (fine for local tutorial runs). Copy .env.example to .env and fill in the key. This is why .env is in .gitignore — the file is meant to stay on your machine only.

A couple of things worth doing regardless:

  • Check with git check-ign…

Replies: 1 comment

Comment options

gbazad93
Aug 25, 2026
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by gbazad93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant