Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve static configuration to be run-time dynamic #1494

Open
sohkai opened this issue Jul 18, 2020 · 0 comments
Open

Improve static configuration to be run-time dynamic #1494

sohkai opened this issue Jul 18, 2020 · 0 comments

Comments

@sohkai
Copy link
Contributor

sohkai commented Jul 18, 2020

The static configuration modules (environment.js and local-settings.js) were built in a hurried fashion a long time ago to support local development and network configuration.

In the time since, it's become pretty clear we have lots of room for improvement.


I have some ideas for a run-time configurable ConfigurationContext, that could also be nicely encapsulated into a use-conf package.

Moving to a run-time configurable config, we would initialize the app with a set of defaults, like we do now, but configuration panels or URL parameters could be used to control the app at run time.

Some other thoughts from @bpierre:

The process.env part could be done by passing a small function to the provider to read the defaults, one to read the current value (e.g. local storage) and another one to write (we could use local storage by default here too).

Another thing I was thinking about would be to have two ways to declare an config value in the env vars: as a default if not set, and as a way to set the value when the app starts. For example, we could have ARAGON_ASSET_BRIDGE=local yarn start as a default, and SET_ARAGON_ASSET_BRIDGE=local yarn start to force it. The use-configuration provider could let us say “use this value as a default” or “use this value and write it if needed”. We could also provide a function, as a separate export to convert from ARAGON_ASSET to aragonAsset, so that it would be super easy to set the former as an env var, and the latter in the code.

@sohkai sohkai changed the title Update static configuration Improve static configuration to be run-time dynamic Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant