diff --git a/README.md b/README.md index 4d6c873..5f876cf 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ npm ci ``` ### Configuration -You can customize the application settings via a configuration file. By default, this configuration file resides in `config/config.json`. However, it is possible to adjust this path via the `CONFIG_FILE` environment variable. Note that the given path has to be either absolute (i.e. starting with `/`) or relative to the `config/` folder (i.e. it defaults to `./config.json`). **Note** that the path to the configuration file needs to be valid and writable because a `namespace` key will be generated and written to the file if it doesn't currently exist. +You can customize the application settings via a configuration file. By default, this configuration file resides in `config/config.json`. However, it is possible to adjust this path via the `CONFIG_FILE` environment variable. Note that the given path has to be either absolute (i.e. starting with `/`) or relative to the `config/` folder (i.e. it defaults to `./config.json`). **Note** that the path to the configuration file needs to be valid and writable because a `namespace` key will be generated and written to the file if it doesn't currently exist. **Note** that if the file exists and contains invalid JSON data, JSKOS Server will refuse to start. Currently, there are only two environment variables: - `NODE_ENV` - either `development` (default) or `production`; currently, the only difference is that in `production`, HTTPS URIs are forced for entities created on POST requests. diff --git a/config/index.js b/config/index.js index d945537..ce47009 100644 --- a/config/index.js +++ b/config/index.js @@ -49,7 +49,8 @@ let configUser = {} try { configUser = JSON.parse(fs.readFileSync(configFilePath)) } catch(error) { - console.warn(`Warning: Could not load configuration file from ${configFilePath}. The application might not behave as expected.`) + console.error(`Warning: Could not load configuration file from ${configFilePath}. Please check whether it is valid JSON and restart the application.`) + process.exit(1) } if (env == "test") { configUser = _.pick(configUser, ["mongo"])