Note: Prior to Astronomer v0.9, the answer would have been yes, you can. Historically, users had been able to add airflow.cfg to the main directory of their project and it would be included when the image built via astro airflow start or astro airflow deploy.
I ended up deleting the airflow.cfg file and setting the ENV vars on the Dockerfile like so:
FROM astronomerinc/ap-airflow:0.10.3-1.10.5-onbuild AS base
ENV AIRFLOW__SMTP__SMTP_HOST="smtp-relay.example.com" \
AIRFLOW__SMTP__SMTP_PORT="25" \
AIRFLOW__SMTP__SMTP_SSL="false" \
AIRFLOW__SMTP__SMTP_STARTTLS="false" \
AIRFLOW__SMTP__SMTP_MAIL_FROM="noreply@example.com"
And now they show up properly on the Airflow config section:
My SMTP relay for the PoC doesn’t require SSL/TLS or authentication though.
Hi @tonejito! I just updated the original answer here, but I chatted with my team and discovered that if you’re running Astronomer v0.9 or later, you actually won’t be able to leverage your own airflow.cfg.
Happy to hear you were able to add them via your Dockerfile! You’ll always be able to either do that or inject them directly via the Astronomer UI (on your Deployment’s “Configure” page). Let us know if there’s anything else we can do to help!
I’m guessing Astronomer doesn’t support ability to do this and forces LocalExecutor mode for local runs of astro dev start? Is it possible to also allow for DebugExecutor as it would greatly help those who’d like to debug dags from their IDE (e.g., PyCharm)?
Isn’t the .env file exactly for that? I added my env’s in this file, hit astro dev restart and it worked
# inside .env in the root directory
AIRFLOW__CORE__TEST_CONNECTION=Enabled
I see problems with the other approaches:
Add them via the Astronomer UI (Deployment > Configure > Env Vars)
→ Does not work in local def mode
Add them to your Dockerfile (a file programmatically generated when you initialize a project on Astronomer via the CLI)
→ The container needs to be rebuild every time you change a env, which takes time
This is a pretty old post and Astronomer has come a long way in how we manage Env variables. I would suggest reading Manage Environment Variables in Astro.
Please feel free to ask a new question on this topic. I will close this topic as it is stale.