Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kritzcreek/dockerconfig-ng
Dockerconfig done right
https://github.com/kritzcreek/dockerconfig-ng
docker purescript smug
Last synced: about 1 hour ago
JSON representation
Dockerconfig done right
- Host: GitHub
- URL: https://github.com/kritzcreek/dockerconfig-ng
- Owner: kritzcreek
- Created: 2017-02-23T12:02:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-03-08T09:47:20.000Z (over 7 years ago)
- Last Synced: 2024-10-11T23:55:21.255Z (26 days ago)
- Topics: docker, purescript, smug
- Language: PureScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
dockerconfig-ng
===*Forked from https://github.com/krystianity/dockerconfig*
- easy nodejs config for docker (overwrite with ENV vars)
- you must not use "_" in your variable names
- check ./test if you dont understand the readme example (you can run "npm test" to try it)```javascript
//somewhere in your init script/classconst dockerconfig = require("dockerconfig-ng");
//myConfigData = { port: 1234, nested: { something: "no" } };
const myConfigData = require("./config.json");
const config = dockerconfig.getConfig(myConfigData);
global.CONFIG = config;//somewhere else
console.log(CONFIG.port);
console.log(CONFIG.nested.something);//your dockerfile
FROM node:6-onbuild
``````bash
# building & run docker image
# with environment variables to overwrite config datadocker build -t my-config-test .
docker run -e NODE_CONFIG_PORT=5555 -e NODE_CONFIG_NESTED_SOMETHING=yes my-config-test# outputs:
# 555 instead of 1234
# "yes" instead of "no"
```## config versioning
- optional
Versioning helps you to keep application-image and deployment-configuration (via environment-variables) in sync,
since it's not always possible to keep all config-changes backwards-compatible or provide sane defaults.### Usage
In your application/image add a key *configVersion* to your *config.json* (or rather: config-object).
The *configVersion* must be a number, using timestamps is recommended:```json
{
"configVersion": 1464091200
}
```Next add the environment variable *NODE_CONFIG_CONFIGVERSION* with the very same value when running your container:
```bash
$ docker run -e NODE_CONFIG_CONFIGVERSION=1464091200 my-application
```Now `dockerconfig.getConfig()` will throw an exception on version-mismatch.
## Building
`bower install && npm install && npm run compile`
## Authors
- Christoph Hegemann, (smug forker)
- Christian Fröhlingsdorf, [email protected] (original author)
- Elmar Athmer, [email protected] (contributor)