Multi environments


If got a question.
We (and I think like many companies) are using different environments (local, development env, staging env and production env.)

Is it possible to use multiple environments with different configs?
And how does it work?
Our configuration is generated, it will replace the default.json in the config-folder. After deployment, we start the server, but it seems it always has the previous configuration.
We also tried “dynamicConfigReload”, but does it work for storeViews-property?
For some reason, our hosts-urls for the elastic search remain the same before the deployment.

Are we missing something?

Thanks, Kevin

My answer maybe covers a bit more than what you asked initially, but bear with me.

Yes, it is possible to have different config files for different environments.

Vue Storefront uses this package to compile the different configuration files into a single file:

In my current project we have split the configuration into these files:

  • default.json (the file bundled with VSF with the default content)
  • shared.json (all the project specific configuration that should be identical in all environments)
  • docker.json (used by developers when developing within the bundled Docker image)
  • gitlab.json (used within Gitlab CI pipelines)
  • staging.json
  • production.json

We are using an environment variable to tell which config files should be loaded besides default.json, and in which order. Check the docs for the environment variables here:

For example in our Docker environment configuration we have added this line:


This means, that three config files will be loaded: default.json, shared.json and docker.json. In this order.

We have filled in the file contents so that the more specific files contain only the configuration entries that need to be overridden from the more generic file. So shared.json has less content than default.json, and docker.json has less content than shared.json.

It is of course project specific, where and how exactly you should define the NODE_CONFIG_ENV. So for this I cannot give an exact answer.

The location of the final configuration file is core/build/config.json. Verify the results from that file after compiling the configuration. (IIRC, it gets done within yarn build in production mode, and in development mode it gets compiled every time you start the server).