Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikesparr/gcf-config
Configuration using ENV variables within Google Cloud Functions described in https://12factor.net/config
https://github.com/mikesparr/gcf-config
12factor cloud-functions configuration environment-variables
Last synced: about 6 hours ago
JSON representation
Configuration using ENV variables within Google Cloud Functions described in https://12factor.net/config
- Host: GitHub
- URL: https://github.com/mikesparr/gcf-config
- Owner: mikesparr
- License: mit
- Created: 2018-09-13T20:44:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-29T21:56:33.000Z (about 6 years ago)
- Last Synced: 2024-12-21T19:02:29.599Z (20 days ago)
- Topics: 12factor, cloud-functions, configuration, environment-variables
- Language: TypeScript
- Homepage:
- Size: 147 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GCF Config
This is a reusable configuration module to leverage ENV vars for app configuration inspired by https://12factor.net/config# Installation
```
npm install gcf-config
yarn add gcf-config
```# Usage
## Node
``` javascript
const conf = require("gcf-config");// instantiate: assume ENV var API_KEY exists
const config = new conf.Config({
apiKey: "API_KEY"
});// access
const baseUrl = `https://api.google.com`;
const url = `${baseUrl}?api_key=${config.get("apiKey")}`;console.log(`URL: ${url}`);
```## Typescript
``` typescript
import {Config, IConfig} from "gcf-config";// instantiate: assume ENV var API_KEY exists
const config: IConfig = new Config({
apiKey: "API_KEY"
});// access
const baseUrl: string = `https://api.google.com`;
const url: string = `${baseUrl}?api_key=${config.get("apiKey")}`;
```# Testing
```
npm test
npm run coverage
```# Build (compiles Typescript to JS)
```
npm run build
```