3.1.2 • Published 6 years ago
@caviar/plugin-apollo-env v3.1.2
@caviar/plugin-apollo-env
Caviar plugin to apply configurations from Ctrip's apollo config service to process.env
Install
$ npm i @caviar/plugin-apollo-env
Usage
Caviar.config.js
const ApolloEnvPlugin = require('@caviar/plugin-apollo-env')
module.exports = {
plugins: [
new ApolloEnvPlugin({
host: process.env.APOLLO_HOST,
appId: 'my-app',
namespace: 'application',
envs: {
REDIS_HOST: 'redis.host',
REDIS_PORT: {
key: 'redis.port',
// We can override the default namespace 'application'
namespace: 'common'
}
}
})
],
...
}
new ApolloEnvPlugin(options)
- options
Object
- envs
{[string]: string | ConfigOptions}
pair of environment variable key and configuration key - ...CtripApolloOptions options of
ctrip-apollo
- envs
interface ConfigOptions {
// Configuration key name
key: string
// options of `ctrip-apollo` which could override the default options
...CtripApolloOptions
}
License
MIT