3.1.2 • Published 6 years ago

@caviar/plugin-apollo-env v3.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Build Status Coverage

@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
interface ConfigOptions {
  // Configuration key name
  key: string

  // options of `ctrip-apollo` which could override the default options
  ...CtripApolloOptions
}

License

MIT

3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.0

6 years ago