https://dagster.io/ logo
#ask-community
Title
# ask-community
u

吳冠頡

08/30/2023, 6:23 AM
I am trying to let @asset read the API itself ,so I don't have to write the URL into code everything
t

Tim Castillo

08/30/2023, 3:57 PM
Hi! There are a couple options for this, given your needs. If the URL is static, then cleanest option is creating a constant in this file or a separate file, and referencing that. If it's dynamic across environments, I'd set it as an environment variable and access with
os.getenv
If it's dynamic across runs, you might want to consider making a ConfigurableResource for connecting to the API, so you swap out the URL depending on the context.