Hey folks :wave: Looking at prefect and I have a ...
# ask-community
d
Hey folks 👋 Looking at prefect and I have a (user) config related question. We have config library at our place that loads config based on execution environment (dev/stage/prod) etc. and merges it all into a dict. It's something that's familiar and liked by our developers, so having to use a different way to configure prefect is seen as less than ideal. I see that the location of user config is configurable (pun not intended 😉) via an environment variable. It would be great if there was an option to provide user config as a dictionary, which prefect would then merge with it's defaults and environment variables. Is something like this possible and I missed it? If not is there a reason why it couldn't be done? Cheers
Looking at the code a bit, and it seems that config gets loaded on module load and just imported as needed. https://github.com/PrefectHQ/prefect/blob/eb91d975ee8edec06c72a57d93545643ba45e98d/src/prefect/configuration.py#L342 If I get it (and that's a big if 😅) - this potentially reduces the opportunity for something like user provided config dictionary, as the system would need to somehow ensure it gets read before/during loading the configuration module.
k
Hey @Dali, I think this thread is relevant to what you bring up. In short, we can’t do this especially if the config is a nested dictionary. I have seen people use parameters to supply the config. At that point, it’s pretty much the same as your solution.