Application configuration ​
A generated application uses the configuration module to load configuration information based on the environment. It is based on the battle-tested and widely used node-config and loads configuration settings so that they are available via app.get(). On application startup, the configuration will be validated against the configuration schema.
Important
For more information on application configuration and schemas see the configuration API documentation.
Environments ​
The NODE_ENV
environment variable determines which configuration file is used. For example, setting NODE_ENV=development
(in a single command e.g. as NODE_ENV=development npm run dev
) will first load config/default.json
and then merge it with config/development.json
. If no environment is set, config/default.json
will be used.
Default configuration ​
The application uses the following configuration values.
host, port, public ​
These options are used directly in the generated application
host
- Is the hostname of the API serverport
- The port it listens onpublic
- The name of the folder static assets are hosted in
paginate ​
paginate
sets the default and maximum page size when using pagination with a database service.
{
"paginate": {
"default": 10,
"max": 100
}
}
origins ​
origins
contains a list of frontend URLs that requests can be made from. This is used to configure cross origin (CORS) policies and oAuth (Twitter, Facebook etc.) login redirects. For example to develop locally with a create-react-app frontend and deploy to app.feathersjs.com
:
{
"origins": ["http://localhost:3030", "http://localhost:5000", "https://app.feathersjs.com"]
}
authentication ​
authentication
contains the configuration for the authentication service and strategies. See the authentication service configuration for more information. For strategy specific settings refer to the jwt, local and oAuth API documentation.
Databases ​
Depending on the SQL database selected the <database>
setting contains a connection
with the database driver package name and a client
option with the database connection string.
{
"postgresql": {
"connection": "pg",
"client": "postgres://postgres:@localhost:5432/feathers-chat"
}
}
For additional configuration see the database connection guide.
When selecting MongoDB, the mongodb
setting contains the MongoDB connection string.