In the front-end/client side/browser I need to use some variables what I would like to configure with server environment variables.
Is there any known solution to publish server environment variable so that I could use it in the front-end?
In the front-end/client side/browser I need to use some variables what I would like to configure with server environment variables.
Is there any known solution to publish server environment variable so that I could use it in the front-end?
Can you explain the use case a little bit? What are the variables for?
In front-end I have calculator script what redirects client to other service. The redirect address needs to be configurable as the site/code will be deployed to multiple countries.
I resolved the problem like this:
I started to use webpack to bundle my javascripts and in webpack configuration I added:
plugins: [
new webpack.DefinePlugin({
'process.env': {
EVENT_SERVICE: JSON.stringify(process.env.EVENT_SERVICE),
COUNTRY: JSON.stringify(process.env.COUNTRY),
},
})
]
Ok cool seems like you’ve got it handled
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.