@itgorillaz/configify 4.0.0-alpha.1 → 4.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,76 +172,15 @@ export class DatabaseConfiguration {
|
|
|
172
172
|
|
|
173
173
|
### Dealing with Secrets
|
|
174
174
|
|
|
175
|
-
Out of the box, this module can resolve
|
|
175
|
+
Out of the box, this module can resolve secrets from:
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
- AWS Secrets Manager and AWS Parameter Store
|
|
178
|
+
- Azure Key Vault
|
|
179
|
+
- Bitwarden Secrets Manager
|
|
180
|
+
- Google Cloud Secret Manager
|
|
181
|
+
- Custom Remote Configuration Resolver(your own implementation)
|
|
178
182
|
|
|
179
|
-
|
|
180
|
-
npm install @aws-sdk/client-ssm @aws-sdk/client-secrets-manager
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
then you can choose which strategies you would like to use to resolve AWS secrets:
|
|
184
|
-
|
|
185
|
-
```js
|
|
186
|
-
import { ConfigifyModule } from '@itgorillaz/configify';
|
|
187
|
-
import { AwsSecretsResolverFactory } from '@itgorillaz/configify/configuration/resolvers/aws';
|
|
188
|
-
|
|
189
|
-
// use default aws client instances
|
|
190
|
-
ConfigifyModule.forRootAsync({
|
|
191
|
-
secretsResolverStrategies: [
|
|
192
|
-
AwsSecretsResolverFactory.defaultParameterStoreResolver(),
|
|
193
|
-
AwsSecretsResolverFactory.defaultSecretsManagerResolver(),
|
|
194
|
-
],
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// or provide your own aws client instances
|
|
198
|
-
ConfigifyModule.forRootAsync({
|
|
199
|
-
secretsResolverStrategies: [
|
|
200
|
-
new AwsParameterStoreConfigurationResolver(new SSMClient())
|
|
201
|
-
new AwsSecretsManagerConfigurationResolver(
|
|
202
|
-
new SecretsManagerClient(),
|
|
203
|
-
),
|
|
204
|
-
],
|
|
205
|
-
});
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Every configuration attribute stating with `AWS_SECRETS_MANAGER`, `AWS_PARAMETER_STORE`, `aws-secrets-manager` and `aws-parameter-store` will be considered a special configuration attribute and the module will try to resolve it's remote value.
|
|
209
|
-
|
|
210
|
-
E.g.: `.env`
|
|
211
|
-
|
|
212
|
-
```
|
|
213
|
-
MY_DB_PASSWORD=${AWS_SECRETS_MANAGER_DB_PASSWORD}
|
|
214
|
-
MY_API_TOKEN=${AWS_PARAMETER_STORE_API_TOKEN}
|
|
215
|
-
|
|
216
|
-
AWS_SECRETS_MANAGER_DB_PASSWORD=<secret-id-here>
|
|
217
|
-
AWS_PARAMETER_STORE_API_TOKEN=<parameter-name-here>
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
`application.yml`
|
|
221
|
-
|
|
222
|
-
```yaml
|
|
223
|
-
my-db-password: ${aws-secrets-manager.db.password}
|
|
224
|
-
my-api-token: ${aws-parameter-store.api.token}
|
|
225
|
-
|
|
226
|
-
aws-secrets-manager:
|
|
227
|
-
db:
|
|
228
|
-
password: <secret-id-here>
|
|
229
|
-
|
|
230
|
-
aws-parameter-store:
|
|
231
|
-
api:
|
|
232
|
-
token: <parameter-name-here>
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
```js
|
|
236
|
-
@Configuration()
|
|
237
|
-
export class SecretConfiguration {
|
|
238
|
-
@Value('my-db-password') // or @Value('aws-secrets-manager.db.password')
|
|
239
|
-
myDbPassword: string;
|
|
240
|
-
|
|
241
|
-
@Value('my-api-token') // or @Value('aws-parameter-store.api.token')
|
|
242
|
-
myApiToken: string;
|
|
243
|
-
}
|
|
244
|
-
```
|
|
183
|
+
Check the [examples](/examples/) and their documentation to learn how to use them.
|
|
245
184
|
|
|
246
185
|
### Parsing Configuration Values
|
|
247
186
|
|