Skip to content

Server Configuration

Bob Dickinson edited this page Mar 20, 2015 · 1 revision

Overview

Configuration works the same (and is shared) between Synchro server (app.js) and Synchro CLI commands.

Each configuration value is determined by evaluating the following, in order, until a value is found:

  1. Command line parameters
  2. Environment variables
  3. The Configuration File
  4. Built-in, Default Values

Specifying the Configuration File

By default, both the Synchro server and all Synchro CLI commands will use a configuration file named "config.json" in the main application directory of the Synchro server (which is also the directory where Synchro CLI commands for that server will be executed).

You may specify a different configuration file as a command line parameter, or set a reference to the configuration file to be used in an environment variable. In addition to any general configuration settings, the configuration file may contain service definition/configuration, and the list of installed apps for that configuration. This makes it easy to define multiple configurations which might use different services and serve different sets of applications (such as “local”, “azure”, “azure-dev”, etc).

Example: Synchro server with config on command line:

 node app.js -c config.json

Example: Synchro CLI with config on command line:

 synchro new hello-world -c azure.json

Example: Setting the config via an environment variable:

 set SYNCHRO_CONFIG=azure-dev.json

If set via an environment variable (and not overridden on the command line), both the Synchro server and Synchro CLI will use that configuration.

Environment Variables

To define a configuration setting via an environment variable, prefix the setting with SYNCHRO__ and use the __ (double underscore) separator as needed to represent any configuration member paths.

For example, to set the value MODULESTORE.storageAccount (for the Azure module store), you would do:

set SYNCHRO__MODULESTORE__storageAccount=xxxxxxxxxx

Clone this wiki locally