{"id":14986883,"url":"https://github.com/antonybudianto/angular-cli-env","last_synced_at":"2025-10-17T18:16:19.632Z","repository":{"id":57178169,"uuid":"66147262","full_name":"antonybudianto/angular-cli-env","owner":"antonybudianto","description":":package: Environment Variable addon for Angular 2 CLI projects, inspired by Twelve-Factor App","archived":false,"fork":false,"pushed_at":"2016-08-21T11:09:25.000Z","size":11,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T23:09:36.068Z","etag":null,"topics":["addon","angular","angular-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonybudianto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-20T13:06:31.000Z","updated_at":"2018-01-13T08:51:46.000Z","dependencies_parsed_at":"2022-09-14T02:31:14.273Z","dependency_job_id":null,"html_url":"https://github.com/antonybudianto/angular-cli-env","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonybudianto%2Fangular-cli-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonybudianto%2Fangular-cli-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonybudianto%2Fangular-cli-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonybudianto%2Fangular-cli-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonybudianto","download_url":"https://codeload.github.com/antonybudianto/angular-cli-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492868,"owners_count":21113163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addon","angular","angular-cli"],"created_at":"2024-09-24T14:13:44.675Z","updated_at":"2025-10-17T18:16:14.590Z","avatar_url":"https://github.com/antonybudianto.png","language":"JavaScript","readme":"# angular-cli-env\n[![npm version](https://badge.fury.io/js/angular-cli-env.svg)](https://badge.fury.io/js/angular-cli-env)\n\nAngular CLI Env Addon\n\nInspired by [Twelve-Factor App](https://12factor.net/config)\n\nThis addon can generate a constant file from `env.json` so that your environment variable is scalable. For now it only supports generating TypeScript constant exporting file.\n\nFor more [details](https://github.com/antonybudianto/angular-cli-env/wiki/About)\n\n## Prerequisites\n\nThis addon has the following prerequisites:\n\n- Node.js 4.x\n- Angular project created via [angular-cli](https://github.com/angular/angular-cli)\n\n## Installation \u0026 Setup\n\nRun this inside your Angular CLI project:\n\n```sh\nnpm install --save-dev angular-cli-env\n```\n\n## Usage\n\n### Initialize\n\nFirst, you need to initialize things needed for env generation by running:\n\n```sh\nng env:init\n```\n\nIt'll generate 2 files:\n- `env.json` (Your environment variables live here, can be **git-ignored** as you like )\n- `src/app/shared/app-env.interface.ts` (Your environment variable interface for static type, must be checked to source control)\n\nYou only need to this **once**.\n\n### Generate\n\nNext, you can generate the constant file by running:\n\n```sh\nng env\n```\n\nIt'll generate the constant file at `src/app/shared/env.ts`, and this file can be **git-ignored** as you like.\n\nBy default, it will generate a constant file with static type `AppEnv`.\nIf you prefer to use dynamic type, you can add `--typeless` flag when generating.\n\nYou can also custom the path and name using `--path` and `--name` flags.\n\n\u003e When changing path, you need to adjust your app interface's path accordingly\n\n### Access the env in code\n\nJust import the generated file in your app, for example:\n```ts\nimport { Component } from '@angular/core';\nimport { ENV } from './shared/env';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: 'app.component.html',\n  styleUrls: ['app.component.css']\n})\nexport class AppComponent {\n  title = 'app works!';\n\n  constructor() {\n    console.log(ENV.TITLE);\n  }\n}\n\n```\n\n## Authors\n\n- [Antony Budianto](http://twitter.com/antonybudianto)\n- Based on [angular-cli-github-pages](https://github.com/IgorMinar/angular-cli-github-pages)\n\n## License\n\n[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonybudianto%2Fangular-cli-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonybudianto%2Fangular-cli-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonybudianto%2Fangular-cli-env/lists"}