Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
buehler committed May 4, 2016
1 parent ff7cec2 commit 571114a
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 24 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [0.2.0] - 2016-05-04
### Added
- Code coverage
- Possibility to require `json` files through config.
- Possibility to overwrite config according to the actual `NODE_ENV`.

### Changed
- *BREAKING*: Refactored everything to be TypeScript.
- Reloading and usage of config is now static on a class.

## [0.1.7] - 2016-01-14
### Added
- Possibility to parse empty or single element arrays from environmental variables.

## [0.1.6] - 2015-10-21
### Added
- Array parsing feature for environment variables.

### Changed
- Tests

### Removed
- `isStage` and `isProduction` since the environments aren't based on those variables. The only one you should use is `isDebug` as it is used by nodeJS itself (nodeJS determines production mode with `NODE_ENV === 'production'`).

## [0.1.5] - 2015-09-28
### Added
- Feature to redirect environment variables.



[Unreleased]: https://github.com/smartive/node-application-config/compare/v0.2.0...develop
[0.2.0]: https://github.com/smartive/node-application-config/compare/v0.2.0...v0.1.7
[0.1.7]: https://github.com/smartive/node-application-config/compare/v0.1.7...v0.1.6
[0.1.6]: https://github.com/smartive/node-application-config/compare/v0.1.6...v0.1.4
[0.1.5]: https://github.com/smartive/node-application-config/tree/v0.1.4
79 changes: 58 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Also `nodeEnv`, and `isDebug` are set based on `NODE_ENV`, which can be used in

### Parse environment variables

If you want to parse other environmental variables into your application config, and you cannot (or you don't wanna) use `process.env` you can use the parsing feature.
If you declare a config variable with the following pattern: `${ENV_VAR_NAME}`, the config application will match it to the corresponding environment variable.
If you want to parse other environmental variables into your application config, and you
cannot (or you don't wanna) use `process.env` you can use the parsing feature.
If you declare a config variable with the following pattern: `${ENV_VAR_NAME}`,
the config application will match it to the corresponding environment variable.

#### Example

Expand All @@ -31,13 +33,52 @@ export TEST_ENV_VAR=foobar

In this case, `config.db.host` will be parsed to "foobar".

### Require json file

If you need to require a `json` - yes only json, 'cause securty - file, you can do that
with a special pattern. You need to use a relative filepath. If any error happens
during the require process, the variable will have the value `REQUIRE_ERROR` and
will have the error message attached.

The pattern for this feature is: `!{filepath.json}`.

#### Example

`foobar.json`
```json
{
"hello": "world"
}
```

`config.json`
```json
{
"foobar": "!{./foobar.json}"
}
```

Results in:

```json
{
"foobar": {
"hello": "world"
}
}
```

### Parse environment array variables

If you want to overwrite an array with a config variable (maybe you have a list of languages), you can overwrite the array with the following syntax:
If you want to overwrite an array with a config variable (maybe you have a list of languages),
you can overwrite the array with the following syntax:

`ARRAY_ENV=str1|str2|str3`

This feature is only necessary if you want to overwrite an array with environment variables, since you can use arrays in the `config.json` and the `config.local.json` files. If you want to overwrite a variable with a single element array or even an empty array, you can simply pass `str1|` for a single element array or `|` for an empty array.
This feature is only necessary if you want to overwrite an array with environment variables,
since you can use arrays in the `config.json` and the `config.local.json` files.
If you want to overwrite a variable with a single element array or even an empty array,
you can simply pass `str1|` for a single element array or `|` for an empty array.

#### Example

Expand Down Expand Up @@ -90,11 +131,22 @@ Name of the local configuration (which overwrites the base config, but is not ne

default: `config.local.json`

### envConfigName
Name of the environment configuration (which overwrites the base config, but is not necessarily in the version control)
`ENV` will be replaced with `process.env.NODE_ENV`!

default: `config.ENV.json`

### environmentPrefix
Prefix for environment variables that overwrite the configurations

default: `app_config_`

### environmentDelimiter
Which character is used for splitting the environment variables after the prefix is removed.

default: `_`

### enableStateVariables
Enable the automatically set `nodeEnv`, `isDebug`, `isStage` and `isProduction` config variables, based on `NODE_ENV`.
If no `NODE_ENV` is set, `development` is taken as fallback value.
Expand All @@ -107,7 +159,8 @@ When merging config variables, the following priorities are taken into account:

1. Environment variable
2. Local config variable
3. Config variable
3. Environment config file
4. Config variable


## Example
Expand Down Expand Up @@ -151,19 +204,3 @@ config.db.pass == "securePass";
config.db.host == "localhost";
config.db.port == 1337;
```

## Changelog

### v0.1.7

- adding possibility to parse empty or single element arrays from environmental variables.

### v0.1.6

- Removed `isStage` and `isProduction` since the environments aren't based on those variables. The only one you should use is `isDebug` as it is used by nodeJS itself (nodeJS determines production mode with `NODE_ENV === 'production'`).
- Added array parsing feature for environment variables
- Changed tests

### v0.1.5

- Added feature to redirect environment variables
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/buehler/node-application-config.git"
"url": "git+https://github.com/smartive/node-application-config.git"
},
"keywords": [
"npm",
Expand All @@ -29,9 +29,9 @@
],
"license": "MIT",
"bugs": {
"url": "https://github.com/buehler/node-application-config/issues"
"url": "https://github.com/smartive/node-application-config/issues"
},
"homepage": "https://github.com/buehler/node-application-config#readme",
"homepage": "https://github.com/smartive/node-application-config#readme",
"devDependencies": {
"chai": "^3.5.0",
"istanbul": "^0.4.3",
Expand Down

0 comments on commit 571114a

Please sign in to comment.