kazana-config
Advanced tools
Comparing version 3.1.0 to 4.0.0
#!/usr/bin/env node | ||
var exec = require('child_process').exec; | ||
var exec = require('child_process').exec | ||
var GH_TOKEN = process.env.GH_TOKEN; | ||
var repo = require('../package.json').repository.url; | ||
var GH_TOKEN = process.env.GH_TOKEN | ||
var repo = require('../package.json').repository.url | ||
if (!(process.env.CI && GH_TOKEN && repo)) { | ||
process.exit(1); | ||
process.exit(1) | ||
} | ||
exec('git remote set-url origin ' + repo.replace('https://', 'https://' + GH_TOKEN + '@') + ' && '); | ||
exec('git config user.email gregor.martynus@ehealthnigeria.org && '); | ||
exec('git config user.name "eHealth Bot"'); | ||
exec('git remote set-url origin ' + repo.replace('https://', 'https://' + GH_TOKEN + '@') + ' && ') | ||
exec('git config user.email gregor.martynus@ehealthnigeria.org && ') | ||
exec('git config user.name "eHealth Bot"') |
20
index.js
@@ -1,11 +0,23 @@ | ||
var config = require('./lib/config'); | ||
module.exports = getConfig | ||
var _ = require('lodash') | ||
module.exports.rc = require('rc') | ||
var defaults = require('./lib/defaults') | ||
var getPluginDefaults = require('./lib/get-plugin-defaults') | ||
/** | ||
* exports parsed configurations | ||
* | ||
* var config = require('kazana-config') | ||
* config.appPort // 5000 by default | ||
* var getConfig = require('kazana-config') | ||
* getConfig(app).port // 5000 by default | ||
* | ||
* @return Object | ||
*/ | ||
module.exports = config(); | ||
function getConfig (main) { | ||
var name = main.name | ||
var plugins = getPluginDefaults(main) | ||
_.merge(defaults, main.config, {plugin: plugins}) | ||
return module.exports.rc(name, defaults) | ||
} |
@@ -10,3 +10,3 @@ { | ||
"predocs": "rimraf docs/build", | ||
"test": "semistandard && npm run test:node | tap-spec", | ||
"test": "standard && npm run test:node | tap-spec", | ||
"test:coverage": "istanbul cover tests", | ||
@@ -35,4 +35,4 @@ "test:coverage:upload": "istanbul-coveralls", | ||
"dependencies": { | ||
"12factor-config": "^1.0.1", | ||
"lodash": "^3.10.1" | ||
"lodash": "^3.10.1", | ||
"rc": "^1.1.0" | ||
}, | ||
@@ -46,7 +46,7 @@ "devDependencies": { | ||
"semantic-release": "^4.0.3", | ||
"semistandard": "^7.0.2", | ||
"standard": "^5.1.0", | ||
"tap-spec": "^4.0.2", | ||
"tape": "^4.1.0" | ||
}, | ||
"version": "3.1.0" | ||
"version": "4.0.0" | ||
} |
@@ -11,34 +11,51 @@ # kazana-config | ||
Kazana is configured using `.<name>rc` files, using the [rc package](https://www.npmjs.com/package/rc). | ||
The `name` property of your app definition is used as the rc name, so for the example below, it will | ||
look for `.myapprc` files. | ||
```js | ||
// npm install --save git+ssh://git@github.com:eHealthAfrica/kazana-config.git | ||
var config = require('kazana-config') | ||
module.exports = { | ||
name: 'myapp', | ||
version: '1.0.0' | ||
} | ||
``` | ||
Parse [12factor-config](https://www.npmjs.com/package/12factor-config) | ||
compatible configurations | ||
When loaded as plugin, it's looking for a `[plugin.<name>]` section within the `.<app name>rc` files. | ||
Additionally, default configuration can be passed: | ||
```js | ||
module.exports = { | ||
name: 'myapp', | ||
version: '1.0.0', | ||
config: { | ||
admin: { | ||
user: 'myadmin', | ||
password: 'secret' | ||
} | ||
} | ||
} | ||
``` | ||
var config = require('kazana-config').parse({ | ||
funk: { | ||
env: 'KAZANA_FUNK', | ||
default: 'boogie woogie' | ||
} | ||
}) | ||
// config.funk set to `KAZANA_FUNK`, falls back to 'boogie woogie' | ||
Configuration can be also passed ase environment varibales | ||
``` | ||
myapp_admin__password = 'supersecret' npm start | ||
``` | ||
## Settings / Defaults | ||
or as command line arguments | ||
Kazana can be fully configured using environment variables. Below is a list | ||
of all variables used across the services, including their default values where | ||
applicable. | ||
``` | ||
npm start -- --admin.password='supersecret' | ||
``` | ||
Within services, the settings below are accessible at `server.settings.app.<setting name>`, | ||
e.g. `sever.settings.app.dbRawData`. | ||
See https://www.npmjs.com/package/rc#standards for the full list | ||
and order of configuration sources. | ||
Within services, the settings are available as `server.settings.app.<setting path>`, | ||
for example `server.settings.app.admin.password` | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name / Env</th> | ||
<th>Setting Path</th> | ||
<th>Description</th> | ||
@@ -51,4 +68,3 @@ <th>Default / Example</th> | ||
<td colspan="2"> | ||
<strong>kazanaAppPort</strong><br> | ||
KAZANA_APP_PORT | ||
<strong>port</strong> | ||
</td> | ||
@@ -59,4 +75,3 @@ <td><code>5000</code></td> | ||
<td colspan="2"> | ||
<strong>backendPort</strong><br> | ||
KAZANA_BACKEND_PORT | ||
<strong>backend.port</strong> | ||
</td> | ||
@@ -67,7 +82,6 @@ <td><code>4999</code></td> | ||
<td> | ||
<strong>adminUser</strong><br> | ||
KAZANA_ADMIN_USER | ||
<strong>admin.username</strong> | ||
</td> | ||
<td> | ||
CouchDB admin username | ||
Database admin username | ||
</td> | ||
@@ -78,7 +92,6 @@ <td><code>kazana</code></td> | ||
<td> | ||
<strong>adminPass</strong><br> | ||
KAZANA_ADMIN_PASS | ||
<strong>admin.password</strong> | ||
</td> | ||
<td> | ||
CouchDB admin password | ||
Database admin password | ||
</td> | ||
@@ -89,4 +102,3 @@ <td><code>secret</code></td> | ||
<td> | ||
<strong>backendName</strong><br> | ||
KAZANA_BACKEND_NAME | ||
<strong>backend.name</strong> | ||
</td> | ||
@@ -100,4 +112,3 @@ <td> | ||
<td> | ||
<strong>backendLocation</strong><br> | ||
KAZANA_BACKEND_LOCATION | ||
<strong>backendLocation</strong> | ||
</td> | ||
@@ -111,4 +122,3 @@ <td> | ||
<td> | ||
<strong>backendLogFile</strong><br> | ||
KAZANA_BACKEND_LOG_FILE | ||
<strong>backend.log.file</strong> | ||
</td> | ||
@@ -122,4 +132,3 @@ <td> | ||
<td> | ||
<strong>backendLogLevel</strong><br> | ||
KAZANA_BACKEND_LOG_LEVEL | ||
<strong>backend.log.level</strong> | ||
</td> | ||
@@ -133,4 +142,3 @@ <td> | ||
<td> | ||
<strong>backendConfigFile</strong><br> | ||
KAZANA_BACKEND_CONFIG_FILE | ||
<strong>backend.config.file</strong> | ||
</td> | ||
@@ -144,4 +152,3 @@ <td> | ||
<td> | ||
<strong>dbRawData</strong><br> | ||
KAZANA_DB_RAW_DATA | ||
<strong>db.rawData</strong> | ||
</td> | ||
@@ -155,4 +162,3 @@ <td> | ||
<td> | ||
<strong>dbIntegratedData</strong><br> | ||
KAZANA_DB_INTEGRATED_DATA | ||
<strong>db.integratedData</strong> | ||
</td> | ||
@@ -166,4 +172,3 @@ <td> | ||
<td> | ||
<strong>emailService</strong><br> | ||
KAZANA_EMAIL_SERVICE | ||
<strong>emailService</strong> | ||
</td> | ||
@@ -177,4 +182,3 @@ <td> | ||
<td> | ||
<strong>emailAuthUsername</strong><br> | ||
KAZANA_EMAIL_AUTH_USERNAME | ||
<strong>email.auth.username</strong> | ||
</td> | ||
@@ -188,4 +192,3 @@ <td> | ||
<td> | ||
<strong>emailAuthPassword</strong><br> | ||
KAZANA_EMAIL_AUTH_PASSWORD | ||
<strong>email.auth.password</strong> | ||
</td> | ||
@@ -192,0 +195,0 @@ <td> |
@@ -1,3 +0,2 @@ | ||
require('./specs/config'); | ||
require('./specs/parse'); | ||
require('./specs/raw'); | ||
require('./specs/defaults-test') | ||
require('./specs/plugins-test') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
215
2
12634
12
181
2
+ Addedrc@^1.1.0
+ Addeddeep-extend@0.6.0(transitive)
+ Addedini@1.3.8(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
- Removed12factor-config@^1.0.1
- Removed12factor-config@1.3.1(transitive)