Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

caviarjs/ctrip-apollo-env-plugin

Open more actions menu

Repository files navigation

Build Status Coverage

@caviar/ctrip-apollo-env-plugin

Caviar plugin to apply configurations from Ctrip's apollo config service to process.env.

@caviar/ctrip-apollo-env-plugin is a caviar sandbox plugin which means it only works if caviar sandbox is used.

Install

$ npm i @caviar/ctrip-apollo-env-plugin

Usage

Caviar.config.js

const ApolloEnvPlugin = require('@caviar/ctrip-apollo-env-plugin')

module.exports = {
  caviar: {
    plugins: [
      new ApolloEnvPlugin({
        host: process.env.APOLLO_HOST,
        appId: 'my-app',
        namespace: 'application',
        keys: {
          REDIS_HOST: 'redis.host',

          REDIS_PORT: {
            key: 'redis.port',
            // We can override the default namespace 'application'
            namespace: 'common'
          }
        }
      })
    ],
    ...
  },
  ...
}

new ApolloEnvPlugin(options)

  • options Object
    • keys {[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

About

Caviar plugin to apply configurations from Ctrip's apollo config service to process.env

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.