prince-chrismc / user-management

An open-source application delivering a responsive user management experience.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Separate configuration from build artifact

prince-chrismc opened this issue · comments

Front-end

  • create separate config.js that exports a config object
  • hook to verify only config.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.

  1. Build front-end
  2. Build back-end
  3. startup script writes configuration.json from environment variables
  4. web app GETs /configuration.json
  5. read config's "back-end URL"