Skip to content
This repository was archived by the owner on Jul 2, 2018. It is now read-only.

Latest commit

 

History

History
148 lines (139 loc) · 3.12 KB

File metadata and controls

148 lines (139 loc) · 3.12 KB

lib/config module

Use this module for recursive auto parsing of configuration files as discussed at issue #7.

It also contains getCommon method for retreiving instances of preconfigured commonly used libraries (bbrest and jxon).

.get(cliConfig)

  • returns all configuration values
  • cliConfig - optional cli configuration object
config.get(cliConfig)
.then(function(config) {
    // config is object of different configs: bb, bbrc, global, bower, bowerrc and optionally cli
});

.getGlobal

  • returns global configuration file
config.getGlobal
.then(function(globalConfig) {
    // globalConfig is value of the ~/.backbase/bb-cli.json
});

.getBb()

  • returns bb.json file as object
config.getBb()
.then(function(config) {
    // config is value of the ./bb.json file
});

.getBbRc()

  • returns local component configuration by traversing and merging values found in parent dirs
config.getBbRc()
.then(function(localConfig) {
    // localConfig is value of merged .bbrc files
});

.getCommon(cliConfig)

  • returns combined configuration returned by .get but also preconfigured instances of bbrest and jxon
  • cliConfig - optional cli configuration object
config.getCommon()
.then(function(obj) {
    // obj contains config, bbrest and jxon keys
});

.absolutizePath(path)

  • returns abolute path given the relative path or home dir path staring with ~
config.absolutizePath()
.then(function(aPath) {
    // aPath is absolute path
});

Configuration file examples

~/.backbase/bb-cli.json

{
    "name": "John Smith",
    "email": "jsmith@example.com"
}

.bbrc

{
  "scheme": "http",
  "host": "localhost",
  "port": "8080",
  "context": "portalserver",
  "username": "john",
  "password": "HU&69wev*!$8",
  "portal": "myportal",
  "path": "/path/to/the/portalserver",
  "profiles": {
    "dev": {
      "host": "my-host.backbase.dev",
      "port": "80",
      "username": "username",
      "password": "password"
    }
  }
}

bb.json

{
  "name": "myWidget",
  "version": "0.1.0",
  "description": "If provided by bb scaff tool",
  "authors": [{
    "name": "Name Set By bb config",
    "email": "email.set@by.config.bb"
  }],
  "repository": {
    "type": "git",
    "url": "git://path.to.users.stash.repository/provided.by.bb.config.git"
  },
  "license": "Backbase Standard",
  "properties": {
    "myPref": {
      "default": "5"
    }
  }
}

bower.json - link

{
  "name": "my-project",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<name>": "<version>",
    "<name>": "<folder>",
    "<name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

.bowerrc - link

{
  "directory": "app/components/",
  "analytics": false,
  "timeout": 120000,
  "registry": {
    "search": [
      "http://localhost:8000",
      "https://bower.herokuapp.com"
    ]
  }
}