{"id":18778384,"url":"https://github.com/ajsalemo/angular-env-var-with-processenv","last_synced_at":"2026-03-19T06:20:29.761Z","repository":{"id":103500537,"uuid":"564996306","full_name":"Ajsalemo/angular-env-var-with-processenv","owner":"Ajsalemo","description":"An Angular application that shows how to grab environment variables with process.env.","archived":false,"fork":false,"pushed_at":"2022-11-14T22:14:53.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-05T21:02:23.505Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ajsalemo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-12T02:37:24.000Z","updated_at":"2022-11-13T20:35:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e6429cc-a748-4cc2-a1fe-ac159b54fd15","html_url":"https://github.com/Ajsalemo/angular-env-var-with-processenv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ajsalemo/angular-env-var-with-processenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajsalemo%2Fangular-env-var-with-processenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajsalemo%2Fangular-env-var-with-processenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajsalemo%2Fangular-env-var-with-processenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajsalemo%2Fangular-env-var-with-processenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ajsalemo","download_url":"https://codeload.github.com/Ajsalemo/angular-env-var-with-processenv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajsalemo%2Fangular-env-var-with-processenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29317956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T20:44:44.282Z","status":"ssl_error","status_checked_at":"2026-02-10T20:44:43.393Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-07T20:16:10.212Z","updated_at":"2026-02-10T21:32:42.561Z","avatar_url":"https://github.com/Ajsalemo.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# angular-environment-variables-with-processenv\n\nThis repo shows how to utilize `process.env.YOUR_ENV_VARS` with Angular.\n\nBy default, Angular uses the `src/environments/environment.prod.ts` or `src/environments/environment.ts` folder for environment variables - and assumes you will be hardcoding property and values directly within. This differs from other SPAs where you can pass them in via `process.env.` and their respective prefix to expose them to the browser.\n\nThe main points to review are:\n- `package.json`: \n\n```json\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"config\": \"ts-node ./scripts/setenv.ts\",\n    \"dev\": \"npm run config -- --environment=dev \u0026\u0026 ng serve\",\n    \"build\": \"npm run config -- --environment=prod \u0026\u0026 ng build\",\n    \"test\": \"ng test\",\n    \"lint\": \"ng lint\",\n    \"e2e\": \"ng e2e\"\n  }\n```\n\nNote the \"config\" script which is being ran in \"build\". We use `yargs` to set the environment here. Change this as needed (eg., dev, uat, prod, etc.)\n\n- `scripts/setenv.ts`:\n\nThis file picks up the environment we specify (above) through `process.env.` and writes out whatever environment variable's we want to the `src/environments/` file. This picks up ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajsalemo%2Fangular-env-var-with-processenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajsalemo%2Fangular-env-var-with-processenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajsalemo%2Fangular-env-var-with-processenv/lists"}