Environment configuration

The env folder contains different configuration files each one for each environment of the application.

Each file will be mapped with its name as an environment. Use the environment variable RI_ENV for load one configuration or another. The default configuration is development (which is the file development.js)

Database

Configuration of the Mongo database to use.

  • endpoint: ip and port of the database
  • name: name of the database
  • debug: Enable or disable debug messages (from mongo)

Bind

Configuration about the binding of the server socket.

  • port: The binding port of the application

Images

  • path: The root path where the images will be saved
  • cache: The root path where the cache of the images will be saved

Auth

Enables or disables the authorization in the application. By default, the auth mode is based on a bearer authentication based on user tokens.

Restrictions

Restrictions allows the developer to specify black lists or white lists in models, shards or roles for each configuration. If restrictions object is not provided all items are loaded and available.

restrictions: {
    whitelist: {
        shards: ["es_ES"],
        roles: ["user"],
        routes: ["get", "post"]
    },
    blacklist:{
        models: ['Logs', 'User']
    }
}

Example

Here it is a typical configuration:

module.exports = {
   database: {
       endpoint: "localhost:1234",
       name: "my_database",
       debug: false
   },
   bind: {
       port: 9000
   },
   images: {
       path: __dirname + "/../../image",
       cache: __dirname + "/../../image/.cache"
   },
   auth: true,
   restrictions: {
       whitelist: {
           shards: ["es_ES"],
           roles: ["user"]
       },
       blacklist:{
           models: ['Logs', 'User']
       }
   }
};

results matching ""

    No results matching ""