A different way to handle Angular environments
Last updated 10 months ago by alex.alexandrescu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install different-ng-env 
SYNC missed versions from official npm registry.


Angular environments requires multiple files for each environment you would eventually want to deploy it to and these files are required to be commited to the source control system of choice. This makes it difficult to keep private things like api keys, private paths of hashes in case of widely distributed projects.

On top of that most automation engineers would like to avoid editing directly the typescript files mentioned before and would preffer to just supply environment variable.

Taking advantage of the wide spread usage of dotenv this helper tool will clear away your existing main/production environments file, ignore it for versioning (if using git, sorry SVN users), read only the environment variables you need and create a typescript file to be used by the Angular build script.



$ npm i different-ng-env
$ ng-env

Define in .env.example the environment variables you want available to your Angular runtime, for example

URL = "localhost:8080"


The -y flag will look for a .env.example file, if none is found will create an empty one. It will also remove ./src/environments folder from git versioning and add it to .gitignore

$ ng-env -y

Current Tags

  • 0.0.4                                ...           latest (10 months ago)

4 Versions

  • 0.0.4                                ...           10 months ago
  • 0.0.3                                ...           10 months ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |