{"id":13659503,"url":"https://github.com/juanpablob/angular-environment","last_synced_at":"2025-08-24T18:36:31.816Z","repository":{"id":57178350,"uuid":"39383973","full_name":"juanpablob/angular-environment","owner":"juanpablob","description":"AngularJS Environment Plugin","archived":false,"fork":false,"pushed_at":"2020-05-21T10:39:53.000Z","size":3273,"stargazers_count":80,"open_issues_count":4,"forks_count":25,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-19T05:25:32.285Z","etag":null,"topics":["angular","angularjs","environment","environment-variables","environment-vars","npm-package"],"latest_commit_sha":null,"homepage":null,"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/juanpablob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-20T13:00:32.000Z","updated_at":"2024-03-28T19:49:25.000Z","dependencies_parsed_at":"2022-09-10T23:56:58.464Z","dependency_job_id":null,"html_url":"https://github.com/juanpablob/angular-environment","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/juanpablob/angular-environment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanpablob%2Fangular-environment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanpablob%2Fangular-environment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanpablob%2Fangular-environment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanpablob%2Fangular-environment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juanpablob","download_url":"https://codeload.github.com/juanpablob/angular-environment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juanpablob%2Fangular-environment/sbom","scorecard":{"id":540626,"data":{"date":"2025-08-11","repo":{"name":"github.com/juanpablob/angular-environment","commit":"1bf73ebce0d88244bf34d8853710c19c9c2988fe"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":4,"reason":"Found 6/14 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T08:07:21.942Z","repository_id":57178350,"created_at":"2025-08-20T08:07:21.942Z","updated_at":"2025-08-20T08:07:21.942Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271922923,"owners_count":24844231,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["angular","angularjs","environment","environment-variables","environment-vars","npm-package"],"created_at":"2024-08-02T05:01:09.479Z","updated_at":"2025-08-24T18:36:31.768Z","avatar_url":"https://github.com/juanpablob.png","language":"JavaScript","readme":"# AngularJS Environment Plugin\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/angular-environment\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/angular-environment.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"http://bower.io/search/?q=angular-environment\"\u003e\u003cimg src=\"https://img.shields.io/bower/v/angular-environment.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/juanpablob/angular-environment/stargazers\"\u003e\u003cimg src=\"http://img.shields.io/npm/dm/angular-environment.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nAn useful plugin that allows you to set up different variables such as API Url, Sockets, Paths, etc, based on the context of script execution, which means you can set up (for example) different API endpoints depending if you are working on development, stage or production.\n\n⚠️**Warning / Heads up!** Although this plugin works and it does the job, it has been out of development since a while now and it's no longer maintained other than people and community contributions / pull requests.\n\n## Installation\n\nYou can install this package either with `npm` or with `bower`.\n\n### bower\n```shell\nbower install angular-environment\n```\n\n### npm\n```shell\nnpm install angular-environment\n```\n\nThen add `environment` as a dependency for your app:\n\n```javascript\nangular.module('yourApp', ['environment']);\n```\n\n## Documentation\n\nSometimes, during the development of our applications, we need to use different variables depending on what context our application is running.\n\nLet's say you're working on an application that handles an API, and you have a version of your API running locally on your computer or laptop for testing purposes. Besides, you have the final or in-production API running on a server. Certainly, the API endpoints are not the same in both environments, so, this plugin allows you to work with same variable for the same purpose but using different values depending on what context your application is running: development, stage or production.\n\nEven better, you can execute code depending on the running context. In some cases you probably could need run pieces of code only for development environment and not in for production, or vice versa.\n\nSaid that, let's go to configure the plugin and learn how to use it.\n\n### Configuration\n\n* Once installed, inject the `envServiceProvider` into your Angular App config area.\n* Organize the environments as you wish under `domains` and `vars` objects.\n* You can use wildcards (`*`) to describe your domains, i.e.: `*.domain.com`.\n* As optional, you can set defaults variables under `defaults` object within `vars`, to catch not-defined variables in the environments.\n* Finally, in the same config area, you will need to check in which context your application is running, by adding `envServiceProvider.check()` which will automatically set the appropriate environment based on given domains.\n\nHere's a full example:\n\n```javascript\nangular.module('yourApp', ['environment']).\n\tconfig(function(envServiceProvider) {\n\t\t// set the domains and variables for each environment\n\t\tenvServiceProvider.config({\n\t\t\tdomains: {\n\t\t\t\tdevelopment: ['localhost', 'acme.dev.local'],\n\t\t\t\tproduction: ['acme.com', '*.acme.com', 'acme.dev.prod'],\n\t\t\t\ttest: ['test.acme.com', 'acme.dev.test', 'acme.*.com'],\n\t\t\t\t// anotherStage: ['domain1', 'domain2']\n\t\t\t},\n\t\t\tvars: {\n\t\t\t\tdevelopment: {\n\t\t\t\t\tapiUrl: '//api.acme.dev.local/v1',\n\t\t\t\t\tstaticUrl: '//static.acme.dev.local',\n\t\t\t\t\t// antoherCustomVar: 'lorem',\n\t\t\t\t\t// antoherCustomVar: 'ipsum'\n\t\t\t\t},\n\t\t\t\ttest: {\n\t\t\t\t\tapiUrl: '//api.acme.dev.test/v1',\n\t\t\t\t\tstaticUrl: '//static.acme.dev.test',\n\t\t\t\t\t// antoherCustomVar: 'lorem',\n\t\t\t\t\t// antoherCustomVar: 'ipsum'\n\t\t\t\t},\n\t\t\t\tproduction: {\n\t\t\t\t\tapiUrl: '//api.acme.com/v1',\n\t\t\t\t\tstaticUrl: '//static.acme.com',\n\t\t\t\t\t// antoherCustomVar: 'lorem',\n\t\t\t\t\t// antoherCustomVar: 'ipsum'\n\t\t\t\t},\n\t\t\t\t// anotherStage: {\n\t\t\t\t// \tcustomVar: 'lorem',\n\t\t\t\t// \tcustomVar: 'ipsum'\n\t\t\t\t// },\n\t\t\t\tdefaults: {\n\t\t\t\t\tapiUrl: '//api.default.com/v1',\n\t\t\t\t\tstaticUrl: '//static.default.com'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// run the environment check, so the comprobation is made\n\t\t// before controllers and services are built\n\t\tenvServiceProvider.check();\n\t});\n```\n\n### Usage\n\nIn order to read the configured environment variables alongside your Angular App, you need to inject `envService` into your controllers or services:\n\n```javascript\ncontroller('SomeController', ['$scope', 'envService', function($scope, envService) {\n\t// ...\n}]);\n```\n#### get()\nReturns a string with the current environment\n\n```javascript\nvar environment = envService.get(); // gets 'development'\n```\n\n#### set(*string[environment]*)\nSets desired environment. This will overwrite the settled environment during the automatically check in Angular config process (*see Configuration* topic).\n\n```javascript\nenvService.set('production'); // will set 'production' as current environment\n```\n\n#### is(*string[environment]*)\nReturns `true` or `false` if the given environment matches with the current environment.\n\n```javascript\nif (envService.is('production')) {\n\t// actually, the current environment is production\n\t// so, let's make some logic only for production environment\n}\nelse {\n\t// we're not in production environment\n}\n```\n\n#### read(*string[var]*)\nReturns the desired environment variable. If no argument is passed, this method will return all variables associated to the current environment.\n\n```javascript\nvar apiUrl = envService.read('apiUrl'); // gets '//localhost/api'\n\nvar allVars = envService.read(); // gets all variables configured under the current environment\n```\n\nIf the desired variable passed as argument doesn't exists in the current environment, the plugin will check into `defaults` object.\n\n## To-Do\n\n* √ ~~Support for adding domains with wildcards or regex~~.\n* √ ~~Unit testing~~.\n* Support for protocols.\n\n## Support\n\nTo report bugs or request features, please visit the [Issue Tracker](http://github.com/juanpablob/angular-environment/issues).\n\n## Contributing to this plugin\n\nPlease feel free to contribute to the plugin with new issues, requests, unit tests, code fixes or new features. If you want to contribute with some code, create a feature branch and send your pull request.\n\n## License\n\nCopyright 2015-2017, [Juan Pablo Barrientos Lagos (juanpablob)](http://twitter.com/juanpablob)\n\nLicensed under [The MIT License](http://www.opensource.org/licenses/mit-license.php)\u003cbr/\u003e\nRedistributions of files must retain the above copyright notice.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuanpablob%2Fangular-environment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuanpablob%2Fangular-environment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuanpablob%2Fangular-environment/lists"}