1.0.1 • Published 1 year ago
@hilma/secrets-handler v1.0.1
secrets-handler
This package handles the projects secrets and gets the secrets from env file or from aws
secrets-handler is a package for getting secrets, from an env file or from aws secrets manager.
Installation
$ npm i @hilma/secrets-handler
Setup
in app module change forRoot => forRootAsync
for connector(db) secrets you should follow this syntax:
ALIAS_HOST ALIAS_PORT ALIAS_PASSWORD ALIAS_ENGINE ALIAS_USER ALIAS_SECRET_NAME
in tsconfig file add:
“include”: “node_modules/@hilma/secrets_handler”, “src”
If types are not visible:
Restart ts server or enter node_modules/@hilma/secrets_handler/secrets_handler.d.ts
Usage
call getSecrets with an array, according to the table below.
Array type for getSecrets
key/s | value/ typeof value | what for | ||
---|---|---|---|---|
objType required | connector - for databases unknown - for singleton secretpreknown - for preknown values | to determine the type of the secret and get it accordingly. | ||
name required | string | the name refering to the object in the code.privateSecretname | ||
aliasrequired | string | short string that precedes env variables names. ex: DB_NAME and DB_SECRET_NAME - "DB" is the alias | ||
envNamerequired for objType unknown | array containing names of the wanted aliases from the env | To get them from the env file | database information | Use in cases when the key is not in the env file or you want to override it. |
valuerequired for objType preknown | object. key: string, value: any. | for secrets that do not have data in the env file. | ||
port, engine, host, dbname, username, paswordoptional for objType connector | string / number | hard coded data for your db connection |
1.0.1
1 year ago
1.0.0-beta.0.9
2 years ago
1.0.0-beta.0.8
2 years ago
1.0.0
2 years ago
1.0.0-beta.0.6
2 years ago
1.0.0-beta.0.5
2 years ago
1.0.0-beta.0.4
2 years ago
1.0.0-beta.0.3
2 years ago
1.0.0-beta.0.2
2 years ago
1.0.0-beta.0.1
2 years ago