Configuration loading

One of the key aspects of a Thorin application is the way it loads the configuration data from various sources, based on the environment it is launched in. A configuration source is a place from which we can read and parse data, that our application will later use as configuration. Out of the box, Thorin offers two configuration sources: disk and sconfig. When you start your application, Thorin will automatically look for configuration under config/{entryFile}.js and config/env/{environment}.js

You can add additional configuration sources by calling the thorin.addConfig(name, opt, _fn) function.

In order to get started with, please follow the steps on the official repo.

thorin.addConfig(sourceType, options, onLoaded)
Registers a new configuration source in your application.
  • sourceTypeenum(disk, sconfig)* the configuration source type.
  • optobject* configuration passed to the source loader (see below)
  • onLoadedfunction, optional callback function to call after calling the source
Disk loader options
  • pathstring* the path of the file to load, including extension. Current extensions: json, js
  • absoluteboolean, false if set to true, use the full path, otherwise use thorin.root + path
  • requiredboolean, true should the app be shutdown if we cannot load this source
SConfig loader options
  • keystring*The 32-char API key or the long access token
  • secretstringWhen used with the 32-char API key, the sconfig application's secret key.
  • versionstring, latestThe configuration version to load from
'use strict';
const thorin = require('thorin');
   .addConfig('disk', {
      path: 'config/custom.js'  // loaded from app/config/custom.js
   .addConfig('sconfig', {
      key: '{32-char API key}',
      secret: '{32-char API Secret}',
      version: 'latest'
Do you have a question or is something missing?

You can always create a new issue on GitHub or contact one of the core founders by chat.