@availity/env-var
Advanced tools
Comparing version 1.11.1 to 1.11.2
@@ -6,2 +6,10 @@ # Change Log | ||
## 1.11.2 (2021-10-22) | ||
**Note:** Version bump only for package @availity/env-var | ||
## 1.11.1 (2021-05-17) | ||
@@ -8,0 +16,0 @@ |
@@ -10,7 +10,3 @@ export type ENVIORNEMNT = 'local' | 'test' | 'qa' | 'prod'; | ||
declare function envVar<T>( | ||
envOpts: EnvOpts<T>, | ||
windowOverride?: Window, | ||
defaultVar?: T | ||
): T; | ||
declare function envVar<T>(envOpts: EnvOpts<T>, windowOverride?: Window, defaultVar?: T): T; | ||
@@ -17,0 +13,0 @@ declare function setEnvironments(envs: EnvOpts<any>, override?: boolean): void; |
@@ -8,8 +8,8 @@ "use strict"; | ||
}); | ||
exports["default"] = _default; | ||
exports.getCurrentEnv = getCurrentEnv; | ||
exports.getLocation = getLocation; | ||
exports.getSpecificEnv = getSpecificEnv; | ||
exports.setEnvironments = setEnvironments; | ||
exports.setSpecificEnvironments = setSpecificEnvironments; | ||
exports.getLocation = getLocation; | ||
exports.getCurrentEnv = getCurrentEnv; | ||
exports.getSpecificEnv = getSpecificEnv; | ||
exports["default"] = _default; | ||
@@ -16,0 +16,0 @@ require("core-js/modules/es.string.match.js"); |
{ | ||
"name": "@availity/env-var", | ||
"version": "1.11.1", | ||
"version": "1.11.2", | ||
"description": "Availity-specific way to determine variables based on the current environment the code is running in", | ||
@@ -31,3 +31,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "4e1d7493ccf0ba9e776476efc86088f4324618cd" | ||
"gitHead": "a247c20c27816eb3e3b68b983d12631a6cadd72b" | ||
} |
@@ -12,3 +12,3 @@ # env-var | ||
```bash | ||
$ npm install @availity/env-var | ||
npm install @availity/env-var | ||
``` | ||
@@ -19,5 +19,5 @@ | ||
```bash | ||
$ yarn add @availity/env-var | ||
yarn add @availity/env-var | ||
``` | ||
## [Documentation](https://availity.github.io/sdk-js/features/env-var) |
@@ -32,11 +32,4 @@ // Cloud domains are in the format <team>.<cloud provider><zone>.availity.com | ||
local: ['127.0.0.1', 'localhost'], | ||
test: [ | ||
/^t(?:(?:\d\d)|(?:est))-apps$/, | ||
(options) => /^t(?:(?:\d\d)|(?:st))$/.test(getCloudEnv(options)), | ||
], | ||
qa: [ | ||
/^q(?:(?:\d\d)|(?:ap?))-apps$/, | ||
(options) => | ||
/^(stg|q(?:(?:\d\d)|(?:ua)|(?:ap)))$/.test(getCloudEnv(options)), | ||
], | ||
test: [/^t(?:(?:\d\d)|(?:est))-apps$/, (options) => /^t(?:(?:\d\d)|(?:st))$/.test(getCloudEnv(options))], | ||
qa: [/^q(?:(?:\d\d)|(?:ap?))-apps$/, (options) => /^(stg|q(?:(?:\d\d)|(?:ua)|(?:ap)))$/.test(getCloudEnv(options))], | ||
prod: [/^apps$/, (options) => getCloudEnv(options) === 'prd'], | ||
@@ -43,0 +36,0 @@ }; |
import envVar, { setEnvironments, getSpecificEnv } from '../src'; | ||
const setHostname = hostname => { | ||
const setHostname = (hostname) => { | ||
// eslint-disable-next-line no-undef | ||
@@ -25,5 +25,3 @@ jsdom.reconfigure({ | ||
test('should default to local when it cannot determine the environment', () => { | ||
expect(envVar({ prod: false, local: true, qa: false, test: false })).toBe( | ||
true | ||
); | ||
expect(envVar({ prod: false, local: true, qa: false, test: false })).toBe(true); | ||
}); | ||
@@ -79,69 +77,17 @@ describe('Default environments', () => { | ||
for (const args of [ | ||
[ | ||
'fallback-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
['fallback-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['localhost', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['127.0.0.1', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
[ | ||
'test-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
[ | ||
't01-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
[ | ||
't14-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
[ | ||
'qa-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
[ | ||
'qap-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
[ | ||
'q01-apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('apps.availity.com'), | ||
], | ||
[ | ||
'apps.availity.com', | ||
'qa', | ||
getFakeWindowLocation('q01-apps.availity.com'), | ||
], | ||
[ | ||
'apps.availity.com', | ||
'prod', | ||
getFakeWindowLocation('bar.awp.availity.com', '/cdn/prd/index.html'), | ||
], | ||
[ | ||
'apps.availity.com', | ||
'qa', | ||
getFakeWindowLocation('bar.awn.availity.com', '/cdn/q01/index.html'), | ||
], | ||
[ | ||
'apps.availity.com', | ||
'test', | ||
getFakeWindowLocation('bar.awn.availity.com', '/cdn/tst/index.html'), | ||
], | ||
[ | ||
'apps.availity.com', | ||
'qa', | ||
getFakeWindowLocation('bar.aws.availity.com', '/cdn/q01/index.html'), | ||
], | ||
[ | ||
'apps.availity.com', | ||
'test', | ||
getFakeWindowLocation('bar.aws.availity.com', '/cdn/tst/index.html'), | ||
], | ||
['test-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['t01-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['t14-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['qa-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['qap-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['q01-apps.availity.com', 'prod', getFakeWindowLocation('apps.availity.com')], | ||
['apps.availity.com', 'qa', getFakeWindowLocation('q01-apps.availity.com')], | ||
['apps.availity.com', 'prod', getFakeWindowLocation('bar.awp.availity.com', '/cdn/prd/index.html')], | ||
['apps.availity.com', 'qa', getFakeWindowLocation('bar.awn.availity.com', '/cdn/q01/index.html')], | ||
['apps.availity.com', 'test', getFakeWindowLocation('bar.awn.availity.com', '/cdn/tst/index.html')], | ||
['apps.availity.com', 'qa', getFakeWindowLocation('bar.aws.availity.com', '/cdn/q01/index.html')], | ||
['apps.availity.com', 'test', getFakeWindowLocation('bar.aws.availity.com', '/cdn/tst/index.html')], | ||
]) { | ||
@@ -148,0 +94,0 @@ generateTest(...args); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
30982
593