1.0.8 • Published 3 years ago

env-is-on v1.0.8

Weekly downloads
4
License
ISC
Repository
github
Last release
3 years ago

Development Environment Simulator

This tool simulates web app running environment by running a "man in the middle" proxy that rewrites or bridges requests to any environment you choose. It enables you to develop and test local module as part of the whole infrastructure in targetting environment.

Installation

From NPM

  • npm install env-is-on

From source

  • Git clone this repo
  • npm install all packages
  • run node ./

Usage

  • Run env-is-on -m [path to mapping config] -b [path to bridging config] -p [the port you name it], e.g env-is-on -b ./bridges/my-app
  • Open .http-mitm-proxy/ca.pem and trust this root ca.
  • Set your browser's proxy to localhost:the port you have specified

Arguments

  • -mapping, -m: path to a folder contains mapping files
  • -bridges, -b: path to a bridge file
  • -avoid-mapping-when-bridged, -a: default to true, mapping file will be executed the request has been bridged.

Bridge and Mapping

Bridge is simple request redirection between 2 different origins while mapping can do much more complex stuffs such as replace page content.

Bridge Config

module.exports = [{
  from: {
    host: 'example.com',
    pathname: /^\/api\/(?!endpoint\/)/,
  },
  to: {
    pathname: '/',
    protocol: 'http:',
    host: 'localhost',
    port: 3000
  }
},{
  from: {
    host: 'example.com',
    pathname: '/api/endpoint/',
  },
  to: {
    pathname: '/api/version1.3/endpoint/',
    protocol: 'https:',
    host: 'example.com',
    port: 443
  }
},{
  // config for react sockjs request to passthrough
  from: {
    host: 'example.com',
    pathname: '/sockjs-node/',
    referer: 'https://example.com/1/admin/',
    port: 3000
  },
  to: {
    pathname: '/sockjs-node/',
    protocol: 'http:',
    host: 'localhost',
    port: 3000
  }
}];

Mapping

TODO

1.0.8

3 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago