2.2.0 • Published 6 years ago
@wunderflats/configman v2.2.0
configman
Tool for defining and checking environment variables in one place.
npm install @wunderflats/configmanUsage
const envVars = ['PORT', 'HOSTNAME']
const configman = require('@wunderflats/configman')
.ensureAllSet(envVars)
http
.createServer()
.listen(configman.get('PORT'), configman.get('HOSTNAME'))API
require('@wunderflats/configman')
const configman = require('@wunderflats/configman')Returns an object of type Configman:
type Configman = {
ensureAllSet(environmentVariables: string[]): Configman,
get(environmentVariable: string): string
}ensureAllSet()
configman.ensureAllSet(environmentVariables: string[]) : ConfigmanChecks if all environment variable are set and throws if not. Returns configman.
process.env.PORT = 1337
process.env.YAWP = undefined
configman.ensureAllSet(['PORT'])
console.log(configman.get('PORT')) // { PORT: 1337}
config = configman
.ensureAllSet(['YAWP']) // throws since `YAWP` is not set (part of `process.env`)get()
configman.get(environmentVariable: string): stringReturns an object containing properties for all configured environment variables.
Throws if one of those variables is not set (part of process.env) when
accessed.
process.env.PORT = 1337
process.env.YAWP = undefined
const PORT = configman
.get('PORT')
console.log(PORT) // 1337
const YAWP = configman
.get('YAWP') // throws since `YAWP` is not set (part of `process.env`)2.2.0
6 years ago
2.1.0
6 years ago
2.0.4
9 years ago
2.0.3
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
1.0.3
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago
0.1.0
10 years ago
0.0.10
10 years ago
0.0.9
10 years ago
0.0.8
10 years ago
0.0.7
10 years ago
0.0.6
10 years ago
0.0.5
10 years ago
0.0.4
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago