Gathering detailed insights and metrics for @ng-heroes/ng-process-env
Gathering detailed insights and metrics for @ng-heroes/ng-process-env
Gathering detailed insights and metrics for @ng-heroes/ng-process-env
Gathering detailed insights and metrics for @ng-heroes/ng-process-env
Angular schematics and builder to retrieve values from System Environment (OS) variables and update relevant `environment.ts` file.
npm install @ng-heroes/ng-process-env
Typescript
Module System
Node Version
NPM Version
TypeScript (98.49%)
JavaScript (1.51%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
20 Stars
47 Commits
3 Forks
10 Branches
1 Contributors
Updated on Feb 25, 2025
Latest Version
1.0.7
Package Id
@ng-heroes/ng-process-env@1.0.7
Unpacked Size
146.71 kB
Size
35.18 kB
File Count
60
NPM Version
6.13.4
Node Version
12.14.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Angular already has his own environment system, can configure everything in src/environments/environment.ts and you can create as many environments as you want. The problem is, sometimes you want to use the System Environment variables, for example, some configuration from the CI server or if build process is running "on-premise" server, in this case, Angular environment system will not help.
ng-process-env will help you to retrieve values from System Environment variables and update relevant environment.ts
file.
Just add it into your app.
1ng add ng-process-env
You will be prompted to insert relevant project name project name.
You can skip it and use schematics generator later by running:
1ng g ng-process-env:process-env
Insert project name
1? Project name to update angular.json config. 2(you can skip and do it later using schematics or manually) my-app 3 Project my-app will be updated 4 Env File will be created at apps/my-app/src/environments
Define environment name
1? You can set name for config to be updated or added as a new one, 'onprem' - default
#Collect Vars
To update the created environment ts file with variables from process.env:
1ng run my-app:collect-vars
#More details
Navigate to apps/my-app/src/environments
Open a new created file environment.onprem.ts
Should looks similar to:
1export const environment = { 2 production: false, 3 envVar: { 4 /** 5 * Add environment variables you want to retrieve from process 6 * PORT:4200, 7 * VAR_NAME: defaultValue 8 */ 9 } 10};
Add variable names you want to be retrieved from process.env
.
We suggest you to add default values too.
environment.onprem.ts
1export const environment = { 2 production: false, 3 envVar: { 4 API_URL: 'http://localhost:3000', 5 servePort: 4200, 6 customer_id: '700', 7 otherKey: 'defaultValue' 8 } 9};
To update environment.onprem.ts with variables from environment run:
1ng run my-app:collect-vars
Updated environment.onprem.ts.
1export const environment = { 2 production: false, 3 envVar: { 4 otherKey: 'defaultValue', 5 API_URL: "api.domain.com", 6 servePort: 5000 as number, 7 customer_id: "1234" 8 } 9};
environment.onprem.ts | Type | exported value (process.env[someKey]) | Will be changed with |
---|---|---|---|
API_URL: 'localhost:3000' | string | 'api.domain.com' | API_URL: 'api.domain.com' |
servePort: 4200 | number | 5000 | servePort: 5000 as number |
customer_id: '700' | string | 1234 | customer_id: '1234' |
otherKey: 'defaultValue' | string | null or undefined | otherKey: 'defaultValue' |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 0/24 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
45 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More