OpenShock/WebUI

Make selfhostable with runtime environment variable substitution

Closed this issue · 5 comments

as I said before,already doing that, see webpack js

I looked at the webpack.config.js but I don't see anything that looks to me like variable substitution at runtime.

I did see this: https://github.com/Shock-Link/WebUI/blob/0c498c0e30f8d4d4644faa3e35b151069bb48b49/webpack.config.js#L86-L91

But that's also compile time:

The DefinePlugin replaces variables in your code with other values or expressions at compile time. This can be useful for allowing different behavior between development builds and production builds

If there's something I'm missing then I'm all ears! Eager to learn

yes, but it should just be that, but you do it in main.js

nevermind, you cannot get anything at runtime, since it doesnt have a runtime, its just statically built files.

Yeah exactly. The trick is to grab the container env vars on startup, substitute them in the *.js files, and then start serving files. Should be easy :)