How to specify env variables in config.json

Currently inside the config.production.json we have the following:

  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "some-user-name",
      "password": "some-user-password",
      "database": "ghost_production"
    }
  },

It’s not OK to hardcode user and password values into config, so I want to use the environment variables to pass the values. What’s the correct syntax in the configuration to do that? Something like:

  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "USER_ENV_VARIABLE",
      "password": "PASSWORD_ENV_VARIABLE",
      "database": "ghost_production"
    }
  },

I’ve found this blog post but it doesn’t show how this could be done. Thanks!

If you want to pass data via env vars, you need to do so when spawning the process, not in the configuration file.

database__connection__password=5up3rs3cr3t node index.js

thanks! the env variable will override the value in the config, right?