/li-rnr-app

Lithium RnR Application

Primary LanguageJavaScript

Build Status Coverage Status Dependency Status

Lithium RnR Application

Install

  1. Install NodeJs
  2. Install git and setup github using these instructions
  3. Start a new terminal and run the following commands:
# Install gulp globally
npm install -g gulp;

# Create and go into folder where you want to store the Lithium code
mkdir lia; cd lia

# Clone the li-rnr-app branch
git clone https://github.com/lithiumtech/li-rnr-app.git

# Install the npm dependencies in li-rnr-app (dependencies are stored in li-rnr-app folder)
cd li-rnr-app; npm install;

# Add port to config/local/local.username.json file like:   "port":3000,

# Run the app using the default command gulp (/path/to/li-rnr-app/node_modules/.bin)
gulp

Config

Configs are loading using nconf. The config store is built up using a hierarchical structure loaded in the following order where a latter definition will override a former one:

  • Command line arguments. Example: gulp app --NODE_ENV=production
  • Environment arguments. Example: NODE_ENV=production gulp app
  • The file contents of: li-rnr-app\config\env\all.js
  • The file contents of: li-rnr-app\config\env\<NODE_ENV>.json where NODE_ENV is a command line argument or global env. Defaults to development.
  • Teh file contents of: li-rnr-app\config\local\local.<system-user-name>.json where <system-user-name> is the current system user.
  • Any files specified by the global env. value configs or the command line argument --configs. This takes a comma separated list of files relative to li-rnr-app.

Example Config from CLI:

gulp app --configs=../../some-config-file.json,../foo/some-other-config.json --NODE_ENV=production

If a config file does not exist it will be omitted.

The contents of all configs specified will be deep merged in the order specified and made accessible to the application via the li-rnr-app\configs\config module.

Example Config Use:

var config = require('./config/config');

console.log('App started on port: ' + config.get('port'));