Separate configuration from build artifact
prince-chrismc opened this issue · comments
Front-end
-
create separateconfig.js
that exports aconfig
object -
hook to verify onlyconfig.js
accesses environment variables
Update: Neither of the options listed were supported via WebPack
Back-end
- Add configuration for CORS headers (possibly command line interface)
- look into steamline configuration file like toml
https://www.pluralsight.com/guides/how-to-store-and-read-configuration-files-using-react
Doing more research there seems to be a lot more options out there.
This really appears to be a technical limitation with the original design of the project.
Using webpack allowed for the static output to be hosted via the C++ backend but that "static" requires the building the artifact with the configuration 🤔
In order to achieve this goal its possible use a hybrid solution where the frontend is hosted by a node.js server like express or https://github.com/fastify/fastify which looks very promising.
Still more research to see how this can be over come
static pre-rendered data, which is the fastest browsing seems to really be limited on this front prince-chrismc/Hello-Next@8dce160
As soon as any packing takes place, it needs to be built into the artifact! very frustrating topic!
This has dropped in priority since the front-end needs to be built with the correct FQDN for technical reasons and the back-end will be deployed in HTTP. There is no configuration which can no be set from the docker images
A possibility here is to have a configuration file, not a part of the web application, but the micro service hosted/exposed by the web server.
- Build front-end
- Build back-end
- startup script writes
configuration.json
from environment variables - web app GETs
/configuration.json
- read config's "back-end URL"