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

Load & serve config from filesystem during runtime (SERVER_CONFIG_PATH, UI_CONFIG_PATH) #377

Merged
merged 22 commits into from
Feb 27, 2024

Conversation

madis
Copy link
Member

@madis madis commented Dec 22, 2023

After these changes the server & ui config will be loaded during runtime. It is specified by environment variables given to the server process when its started:

UI_CONFIG_PATH=/path/to/ui-config-qa.edn SERVER_CONFIG_PATH=/path/to/server-config-qa.edn

UI config gets served by the server in JSON format via /config endpoint

madis and others added 18 commits December 22, 2023 01:46
Previously this config was looked up from ethlance root folder under
`config` and the files had to have specific name, e.g. `config/server-config-qa.edn`

Now when COMPILING the project for release to non-dev environment e.g.
prod or qa 2 ENV variables need to be set:
1. ETHLANCE_ENV=qa (or prod)
2. ETHLANCE_CONFIG_PATH=/absolute/path-to.edn
The contracts shouldn't be deployed to QA or prod during the automatic build process.
This is because it costs money, it's quite rare that we change the
contracts and also the contract address files (shared/src/ethlance/shared/smart_contracts_{qa,prod}.cljs)
need to be committed to version control to maintain the addresses.

There are ways for doing it via CI but as of now it's not worth the
effort
Earlier the ui & server config was compiled into the JS bundle.

Now:
1. server config gets loaded during runtime as specified by `SERVER_CONFIG_PATH`
2. ui config gets loaded by the server process as specified by `UI_CONFIG_PATH`
  - and served via `/config` endpoint on server http api

The UI application running on browser needs to know where to load the
config from. That's configured by
```edn
   :server-config {:url "http://d0x-vm:6300/config" :format :json}
```
@madis madis changed the title Take non-dev config from ETHLANCE_CONFIG_PATH env variable Load & serve config from filesystem during runtime (SERVER_CONFIG_PATH, UI_CONFIG_PATH) Feb 5, 2024
@madis madis force-pushed the config-via-env branch 2 times, most recently from f0890cb to 8628b81 Compare February 15, 2024 02:07
@madis madis merged commit 1d5d4a5 into newlance Feb 27, 2024
3 checks passed
@madis madis deleted the config-via-env branch February 27, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants