dynamic-config-store
Advanced tools
Comparing version 1.0.5 to 1.1.0
{ | ||
"name": "dynamic-config-store", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "Simple configuration utility for deployments and libraries", | ||
@@ -46,4 +46,4 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"immer": "^1.7.4", | ||
"peerDependencies": { | ||
"immer": "^3.1.1", | ||
"lodash": "^4.17.11" | ||
@@ -59,3 +59,3 @@ }, | ||
"typedoc": "^0.13.0", | ||
"typescript": "^3.1.6", | ||
"typescript": "^3.4.5", | ||
"rollup": "^0.66.2", | ||
@@ -66,4 +66,6 @@ "rollup-plugin-commonjs": "^9.1.8", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-typescript2": "^0.17.0" | ||
"rollup-plugin-typescript2": "^0.17.0", | ||
"immer": "^3.1.1", | ||
"lodash": "^4.17.11" | ||
} | ||
} |
@@ -182,10 +182,25 @@ ## 🔱 Dynamic Config Store | ||
``` | ||
```typescript | ||
const { serverSecret } = ServerConfig.getConfig({ ignoreOverrides: true }); | ||
``` | ||
## Config Reactions | ||
## ✨ Config Reactions | ||
### Deep Merging and Extending | ||
Sometimes you need values in your config which are based off of other values. For this purpose you | ||
can create reactions in the config which will play out after all other values have been set by whatever | ||
means: | ||
```typescript | ||
config.addConfigChangeReaction((config) => { | ||
if (!config.isProductionEnv) { | ||
config.serverSecret = "dev_secret"; | ||
} | ||
}); | ||
``` | ||
You don't need to return a value - simply change the current config directly. The great library [Immer](https://github.com/mweststrate/immer) is used under the covers to | ||
allow this! | ||
## Deep Merging and Extending | ||
All of the methods in `dynamic-config-store` use **deep merging** when changing the config. This | ||
@@ -192,0 +207,0 @@ ensures that your objects deeper in the config tree are not wholly over-written or cleared when you |
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
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
80189
294
16
+ Addedimmer@3.3.0(transitive)
- Removedimmer@^1.7.4
- Removedlodash@^4.17.11
- Removedimmer@1.12.1(transitive)