dipdup-io / dipdup

Modular framework for creating selective indexers and featureful backends for dapps
https://dipdup.io
MIT License
97 stars 52 forks source link

Reload constants in `dipdup.env` after applying env-files #1111

Closed droserasprout closed 1 month ago

droserasprout commented 1 month ago

Currently there is an inconsistency in env variables and env files (-e cli arg). Internal variables like DIPDUP_DEBUG are read once on dipdup.env module import, and thus can't be set with env-files. We need a method to reload constants in dipdup.env on demand. globals are okay, but maybe there are more elegant options without breaking compatibility.

Iwueseiter commented 1 month ago

Hi @droserasprout can I work on this please?

tosoham commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a returning Contributor here. Willing to solve this issue with my expertise in Python.

How I plan on tackling this issue

I would approach this issue by keeping the global varibale DIPDUP_DEBUG and make it such that the new method which will be added in dipdup.env module will have reload constants on demand. This can be done by a reloading function which will reload the varibles in dipdup.env on demand. This function could be invoked after processing env files or CLI arguments. We can also discuss this further if more options are available.