2022-06-17 03:07:30 +00:00
.. _environment_variables:
***** ***** ***** ***** *
Environment Variables
***** ***** ***** ***** *
2022-09-15 13:15:59 +00:00
If your App is using configuration values you don't want to commit with your App source code, you can use environment variables.
2022-06-17 03:07:30 +00:00
2022-09-15 13:15:59 +00:00
Lightning allows you to set environment variables when running the App from the CLI with the `lightning run app` command. You can use environment variables to pass any values to the App, and avoiding sticking those values in the source code.
2022-06-17 03:07:30 +00:00
Set one or multiple variables using the **--env** option:
.. code :: bash
lightning run app app.py --cloud --env FOO=BAR --env BAZ=FAZ
2022-09-15 13:15:59 +00:00
Environment variables are available in all Flows and Works, and can be accessed as follows:
2022-06-17 03:07:30 +00:00
.. code :: python
import os
print(os.environ["FOO"]) # BAR
print(os.environ["BAZ"]) # FAZ
.. note ::
2022-09-15 13:15:59 +00:00
Environment variables are not encrypted. For sensitive values, we recommend using :ref: `Encrypted Secrets <secrets>` .