Hi All! what’s the correct way to use environment ...
# ask-community
s
Hi All! what’s the correct way to use environment variables in
run_config?
Any way to prevent a user from being able to see it in plaintext for a given run?
🤖 1
r
If you parametrize using
StringSource
, you can pass in
env: MY_ENV_VAR
anywhere that you need to use your environment. Users will not see the value in plaintext. https://docs.dagster.io/_apidocs/config#dagster.StringSource
s
Hi @rex, thanks for your response!
Copy code
@op(out=DynamicOut(str), config_schema={
      'script_path': Field(str, is_required=True),
      'slack_token': Field(StringSource, is_required=True)
    }, description="This Op returns DynamicOutput, a list of R scripts")
def op_defn():
    # code here
I tried using
StringSource
like this but I can still see
slack_token
in plaintext in the Run in Dagit. The run was launched via Launchpad in Dagit
specifically, what I want is to hide the
slack_token
that I must pass when using the dagster-slack library https://docs.dagster.io/_apidocs/libraries/dagster-slack
ended up using the run fail sensor from dagster slack library