https://github.com/colorfulcompany/node-gcp-lazy-config
GCP config store with JavaScript file and Firestore and Secret Manager
https://github.com/colorfulcompany/node-gcp-lazy-config
firestore google-cloud-platform nodejs secret-manager
Last synced: 8 months ago
JSON representation
GCP config store with JavaScript file and Firestore and Secret Manager
- Host: GitHub
- URL: https://github.com/colorfulcompany/node-gcp-lazy-config
- Owner: colorfulcompany
- License: bsd-2-clause
- Created: 2020-03-10T09:22:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-25T11:05:46.000Z (over 3 years ago)
- Last Synced: 2023-03-06T14:03:16.226Z (over 2 years ago)
- Topics: firestore, google-cloud-platform, nodejs, secret-manager
- Language: JavaScript
- Homepage:
- Size: 302 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Google Cloud Lazy Config
## Features
* read File in Source Code
* support function
* support Firestore Simple Repository
* support SecretManager## How To Install
add as below in package.json\'s dependencies section
```
"gcp-config-lazy": "https://github.com/colorfulcompany/node-gcp-lazy-config"
```or
```
$ npm install https://github.com/colorfulcompany/node-gcp-lazy-config
```## How To Use
```javascript
const { RepositoryCreator } = require('gcp-firestore-simple-repository')
const { Config, FirestoreReader, SecretReader } = require('gcp-lazy-config');(async () => {
const repos = RepositoryCreate.create()
const store = new FirestoreReader(repos)
const secret = new SecretReader()const config = await Config.init(, { store, secret })
await config.get('credential')
})()
```in config/\.js
```javascript
module.exports = ({ store, secret }) => {
return {
immediate: 'immediate',
func: () => 'val',
asyncFunc: async () => 'async',
doc: async (path) => await store.get('doc', path) || process.env.CONFIG1,
credential: async () => await secret.get('sample') || process.env.SECRET1
}
}
```