For the deployment of a project with a staging and...
# ask-community
f
For the deployment of a project with a staging and production repository. How do people handle deployment to production. Is it possible to pass enviromental variable to the attribute in workspace.yml?
p
There isn’t a way to pass an env var within the workspace.yml, but you could change the repository content based on env vars or point at different workspace.yml files per environment.
s
in our code location we have many submodules, one of which is a
common
submodule. Within that we set a
CURRENT_WORKSPACE
variable as
os.getenv("DAGSTER_WORKSPACE", "dev")
. Then, in our job code, we can do things like
Copy code
from my_repo.common import CURRENT_WORKSPACE

if CURRENT_WORKSPACE == "prod":
    my_secret = fetch_secret("foo")
else:
    my_secret = "bar"
I tried to manage all our secrets via the environment initially, but it was cumbersome. So now, i just make sure our prod and stage deployments have DAGSTER_WORKSPACE set and the code handles the rest