Configuration
Configuration is a JSON file in the config directory. henri loads the file matching your NODE_ENV and falls back to default.json, so you can have default.json, production.json, test.json and so on.
{ "stores": { "default": { "adapter": "mongoose", "url": "mongodb://user:pass@mongoserver.com:10914/henri-test" }, "dev": { "adapter": "disk" } }, "secret": "25bb9ed0b0c44cc3549f1a09fc082a1aa3ec91fbd4ce9a090b", "renderer": "react"}The file is validated on boot: a syntax error is reported with its line and column instead of a stack trace.
| Key | Default | Description |
|---|---|---|
port |
3000 |
Port to listen on. In development a busy port is replaced by the next free one. |
renderer |
template |
View engine: react, template (Handlebars) or vue. See Views. |
stores |
Named database stores. Models pick one with their store key, or use default. See Models. |
|
secret |
Session and JWT secret. Required as soon as you have a user model. | |
user |
User |
Name of the model that represents users (login, roles, password hashing). |
baseRole |
Role given to every new user. | |
graphql |
/_henri/gql |
Path of the GraphQL endpoint. See GraphQL. |
mail |
Nodemailer transport options, or "test" for an Ethereal test account. See Mail. |
Reading the configuration in your code
Section titled “Reading the configuration in your code”The configuration is frozen and exposed on the global henri object:
henri.config.get('stores.default.adapter'); // throws if the key is missinghenri.config.get('mail', true); // returns false instead of throwinghenri.config.has('baseRole');