Roosevelt

Configuration

🔝 Scroll to top

App name

Roosevelt will determine your app's name by examining "name" in package.json. If none is provided, it will use Roosevelt Express instead.

rooseveltConfig

Roosevelt is highly configurable and you can configure it from the following hierarchy of sources in increasing order of precedence:

  • A roosevelt.config.js file.
  • A rooseveltConfig.js file.
  • Constructor parameters.
  • Environment variables.
  • Command line flags.

What "increasing order of precedence" means is that command line flags will override environment variables, environment variables will override constructor parameters, constructor parameters will override the config file, etc.

The config file is a JavaScript file that exports your params. Here's a very simple example that sets one param:

module.exports = {
  http: {
    port: 4000
  }
}

Setting part of a param

Params that hold an object can be set a piece at a time. Anything you leave out keeps its default, so this turns off request logging without disturbing the other logging settings:

module.exports = {
  logging: {
    methods: {
      http: false
    }
  }
}

Params that pass their options along to another module, such as helmet and formidable, accept any option that module takes, whether or not Roosevelt documents it.

Referring to other params in your params

Use ref when you need to reference the value of another param. It takes a function that receives the finished params:

const rooseveltConfig = require('roosevelt/config')
const path = require('path')

module.exports = {
  symlinks: [
    {
      source: rooseveltConfig.ref(param => param.js.sourcePath),
      dest: rooseveltConfig.ref(param => path.join(param.publicFolder, 'js'))
    }
  ]
}

The rooseveltConfig API