stupid-env

0.0.8 • Public • Published

stupid-env

A cli for checking, fast switching, and persisting environment variables

stupid-env NPM downloads

English | 简体中文

Getting started

npm install -g stupid-env

Usage

stupidenv -h               # help
  stupidenv -l             # list all environments
  stupidenv -a             # list all environments and choose one
  stupidenv -s             # choose an available environment directly
  stupidenv -o ./.env.json # specify environment variable persistence file,default: ./.env.json

Once you have selected an environment, the corresponding environment variables will be properly persisted.

// You need to properly configure the `.stupidenv.js` file in the project root directory.
module.exports = [
  {
    name: '182',
    api: 'https://192.168.100.182',
    env: {
      CDN_URL: 'https://192.168.100.182/cdn', // other environment variables that need to be set together
    },
    healthcheck: {
      path: '/dce/healthz', // default: '/'
      headers: {
        token: 'mytoken',
      },
      isHealthy: function (res) {
        return res.data === 'Healthy';
      },
      timeout: 2000, // default: 2000 ms
    },
  },
  {
    name: '100',
    api: 'https://192.168.100.100',
    healthcheck: {
      path: '/dce/healthz',
    },
  },
];

Package Sidebar

Install

npm i stupid-env

Weekly Downloads

12

Version

0.0.8

License

MIT

Unpacked Size

10 kB

Total Files

12

Last publish

Collaborators

  • olivewind