@vyriy/env 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/aws.d.ts +4 -0
- package/aws.js +5 -0
- package/cdk.d.ts +4 -0
- package/cdk.js +4 -0
- package/chaos.d.ts +5 -0
- package/chaos.js +16 -0
- package/ecs.d.ts +5 -0
- package/ecs.js +5 -0
- package/env.d.ts +7 -0
- package/env.js +14 -0
- package/gitlab.d.ts +4 -0
- package/gitlab.js +4 -0
- package/index.d.ts +12 -0
- package/index.js +12 -0
- package/localstack.d.ts +3 -0
- package/localstack.js +3 -0
- package/logger.d.ts +1 -0
- package/logger.js +2 -0
- package/package.json +146 -0
- package/server.d.ts +2 -0
- package/server.js +2 -0
- package/stage.d.ts +28 -0
- package/stage.js +29 -0
- package/types.d.ts +68 -0
- package/types.js +57 -0
- package/vpc.d.ts +4 -0
- package/vpc.js +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vyriy contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @vyriy/env
|
|
2
|
+
|
|
3
|
+
Shared environment variable helpers for Vyriy projects.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package provides small helpers for reading common environment variables used across local development, AWS, ECS, GitLab CI, LocalStack, logging, and stage detection.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
With npm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @vyriy/env
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
With Yarn:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
yarn add @vyriy/env
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { existsEnv, getEnv, getNodeEnv, getStage, isProduction } from '@vyriy/env';
|
|
27
|
+
|
|
28
|
+
const appName = getEnv('APP_NAME');
|
|
29
|
+
const nodeEnv = getNodeEnv();
|
|
30
|
+
const stage = getStage();
|
|
31
|
+
const hasOptionalFeature = existsEnv('OPTIONAL_FEATURE');
|
|
32
|
+
|
|
33
|
+
if (isProduction() && hasOptionalFeature) {
|
|
34
|
+
console.log({ appName, nodeEnv, stage });
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
Core:
|
|
41
|
+
|
|
42
|
+
- `existsEnv(name)`
|
|
43
|
+
- `getEnv(name, defaultValue?)`
|
|
44
|
+
- `getNodeEnv()`
|
|
45
|
+
- `isNodeEnvProduction()`
|
|
46
|
+
- `isNodeEnvDevelopment()`
|
|
47
|
+
- `isNodeEnvTest()`
|
|
48
|
+
|
|
49
|
+
AWS / CDK / ECS:
|
|
50
|
+
|
|
51
|
+
- `getRegion()`
|
|
52
|
+
- `getAccessKeyId()`
|
|
53
|
+
- `getSecretAccessKey()`
|
|
54
|
+
- `getCdkAccount()`
|
|
55
|
+
- `getCdkRegion()`
|
|
56
|
+
- `getStack()`
|
|
57
|
+
- `getEcsClusterName()`
|
|
58
|
+
- `getEcsTaskDefinition()`
|
|
59
|
+
- `getEcsContainerName()`
|
|
60
|
+
- `getTask()`
|
|
61
|
+
|
|
62
|
+
CI / local tooling:
|
|
63
|
+
|
|
64
|
+
- `getCiPipelineId()`
|
|
65
|
+
- `getCiMergeRequestId()`
|
|
66
|
+
- `getCiProjectName()`
|
|
67
|
+
- `getLocalstackHost()`
|
|
68
|
+
- `getLocalstackPort()`
|
|
69
|
+
- `getLogLevel()`
|
|
70
|
+
|
|
71
|
+
Chaos:
|
|
72
|
+
|
|
73
|
+
- `getChaosEnabled()`
|
|
74
|
+
- `getChaosErrorEnabled()`
|
|
75
|
+
- `getChaosTimeoutEnabled()`
|
|
76
|
+
- `getChaosTimeoutMs()`
|
|
77
|
+
|
|
78
|
+
Server:
|
|
79
|
+
|
|
80
|
+
- `getPort()`
|
|
81
|
+
|
|
82
|
+
Stage helpers:
|
|
83
|
+
|
|
84
|
+
- `getStage()`
|
|
85
|
+
- `isLocal()`
|
|
86
|
+
- `isDev()`
|
|
87
|
+
- `isDevelop()`
|
|
88
|
+
- `isTest()`
|
|
89
|
+
- `isTesting()`
|
|
90
|
+
- `isQa()`
|
|
91
|
+
- `isUat()`
|
|
92
|
+
- `isStaging()`
|
|
93
|
+
- `isPreProd()`
|
|
94
|
+
- `isPreProduction()`
|
|
95
|
+
- `isFeature()`
|
|
96
|
+
- `isHotfix()`
|
|
97
|
+
- `isProduction()`
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
|
|
101
|
+
- `existsEnv` only checks whether the variable is defined.
|
|
102
|
+
- `getEnv` throws if the variable is missing and no default value is provided.
|
|
103
|
+
- chaos helpers default to `CHAOS_ENABLED=false`, `CHAOS_ERROR_ENABLED=true`, `CHAOS_TIMEOUT_ENABLED=true`, and `CHAOS_TIMEOUT_MS=1000`.
|
|
104
|
+
- Stage helpers are based on the `STAGE` environment variable.
|
|
105
|
+
- `getNodeEnv` defaults to `'development'`.
|
package/aws.d.ts
ADDED
package/aws.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getEnv } from './env.js';
|
|
2
|
+
import { AwsRegion } from './types.js';
|
|
3
|
+
export const getRegion = () => getEnv('REGION', AwsRegion.EuCentral1);
|
|
4
|
+
export const getAccessKeyId = () => getEnv('AWS_ACCESS_KEY_ID');
|
|
5
|
+
export const getSecretAccessKey = () => getEnv('AWS_SECRET_ACCESS_KEY');
|
package/cdk.d.ts
ADDED
package/cdk.js
ADDED
package/chaos.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GetBooleanEnvWithValue, GetNumberEnvWithValue } from './types.js';
|
|
2
|
+
export declare const getChaosEnabled: GetBooleanEnvWithValue;
|
|
3
|
+
export declare const getChaosErrorEnabled: GetBooleanEnvWithValue;
|
|
4
|
+
export declare const getChaosTimeoutEnabled: GetBooleanEnvWithValue;
|
|
5
|
+
export declare const getChaosTimeoutMs: GetNumberEnvWithValue;
|
package/chaos.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getEnv } from './env.js';
|
|
2
|
+
const enabledValues = new Set([
|
|
3
|
+
'1',
|
|
4
|
+
'true',
|
|
5
|
+
'yes',
|
|
6
|
+
'on',
|
|
7
|
+
]);
|
|
8
|
+
const getBoolean = (name, defaultValue) => enabledValues.has(getEnv(name, `${defaultValue}`).toLowerCase());
|
|
9
|
+
const getNumber = (name, defaultValue) => {
|
|
10
|
+
const value = Number(getEnv(name, `${defaultValue}`));
|
|
11
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
12
|
+
};
|
|
13
|
+
export const getChaosEnabled = () => getBoolean('CHAOS_ENABLED', false);
|
|
14
|
+
export const getChaosErrorEnabled = () => getBoolean('CHAOS_ERROR_ENABLED', true);
|
|
15
|
+
export const getChaosTimeoutEnabled = () => getBoolean('CHAOS_TIMEOUT_ENABLED', true);
|
|
16
|
+
export const getChaosTimeoutMs = () => getNumber('CHAOS_TIMEOUT_MS', 10000);
|
package/ecs.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GetEnvWithValue } from './types.js';
|
|
2
|
+
export declare const getEcsClusterName: GetEnvWithValue;
|
|
3
|
+
export declare const getEcsTaskDefinition: GetEnvWithValue;
|
|
4
|
+
export declare const getEcsContainerName: GetEnvWithValue;
|
|
5
|
+
export declare const getTask: GetEnvWithValue;
|
package/ecs.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getEnv } from './env.js';
|
|
2
|
+
export const getEcsClusterName = () => getEnv('ECS_CLUSTER_NAME');
|
|
3
|
+
export const getEcsTaskDefinition = () => getEnv('ECS_TASK_DEFINITION');
|
|
4
|
+
export const getEcsContainerName = () => getEnv('ECS_CONTAINER_NAME');
|
|
5
|
+
export const getTask = () => getEnv('TASK');
|
package/env.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExistsEnv, GetEnv, GetNodeEnv, IsNodeEnv } from './types.js';
|
|
2
|
+
export declare const existsEnv: ExistsEnv;
|
|
3
|
+
export declare const getEnv: GetEnv;
|
|
4
|
+
export declare const getNodeEnv: GetNodeEnv;
|
|
5
|
+
export declare const isNodeEnvProduction: IsNodeEnv;
|
|
6
|
+
export declare const isNodeEnvDevelopment: IsNodeEnv;
|
|
7
|
+
export declare const isNodeEnvTest: IsNodeEnv;
|
package/env.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const existsEnv = (name) => process.env[name] !== undefined;
|
|
2
|
+
export const getEnv = (name, defaultValue) => {
|
|
3
|
+
if (existsEnv(name)) {
|
|
4
|
+
return process.env[name];
|
|
5
|
+
}
|
|
6
|
+
if (defaultValue !== undefined) {
|
|
7
|
+
return defaultValue;
|
|
8
|
+
}
|
|
9
|
+
throw new Error(`Environment variable ${name} is not defined!`);
|
|
10
|
+
};
|
|
11
|
+
export const getNodeEnv = () => getEnv('NODE_ENV', 'development');
|
|
12
|
+
export const isNodeEnvProduction = () => getNodeEnv() === 'production';
|
|
13
|
+
export const isNodeEnvDevelopment = () => getNodeEnv() === 'development';
|
|
14
|
+
export const isNodeEnvTest = () => getNodeEnv() === 'test';
|
package/gitlab.d.ts
ADDED
package/gitlab.js
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './aws.js';
|
|
2
|
+
export * from './chaos.js';
|
|
3
|
+
export * from './cdk.js';
|
|
4
|
+
export * from './ecs.js';
|
|
5
|
+
export * from './env.js';
|
|
6
|
+
export * from './gitlab.js';
|
|
7
|
+
export * from './localstack.js';
|
|
8
|
+
export * from './logger.js';
|
|
9
|
+
export * from './server.js';
|
|
10
|
+
export * from './stage.js';
|
|
11
|
+
export * from './vpc.js';
|
|
12
|
+
export * from './types.js';
|
package/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './aws.js';
|
|
2
|
+
export * from './chaos.js';
|
|
3
|
+
export * from './cdk.js';
|
|
4
|
+
export * from './ecs.js';
|
|
5
|
+
export * from './env.js';
|
|
6
|
+
export * from './gitlab.js';
|
|
7
|
+
export * from './localstack.js';
|
|
8
|
+
export * from './logger.js';
|
|
9
|
+
export * from './server.js';
|
|
10
|
+
export * from './stage.js';
|
|
11
|
+
export * from './vpc.js';
|
|
12
|
+
export * from './types.js';
|
package/localstack.d.ts
ADDED
package/localstack.js
ADDED
package/logger.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLogLevel: () => "";
|
package/logger.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vyriy/env",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "Shared env utility for Vyriy projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"import": "./index.js",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"./aws": {
|
|
16
|
+
"types": "./aws.d.ts",
|
|
17
|
+
"import": "./aws.js",
|
|
18
|
+
"default": "./aws.js"
|
|
19
|
+
},
|
|
20
|
+
"./aws.js": {
|
|
21
|
+
"types": "./aws.d.ts",
|
|
22
|
+
"import": "./aws.js",
|
|
23
|
+
"default": "./aws.js"
|
|
24
|
+
},
|
|
25
|
+
"./cdk": {
|
|
26
|
+
"types": "./cdk.d.ts",
|
|
27
|
+
"import": "./cdk.js",
|
|
28
|
+
"default": "./cdk.js"
|
|
29
|
+
},
|
|
30
|
+
"./cdk.js": {
|
|
31
|
+
"types": "./cdk.d.ts",
|
|
32
|
+
"import": "./cdk.js",
|
|
33
|
+
"default": "./cdk.js"
|
|
34
|
+
},
|
|
35
|
+
"./chaos": {
|
|
36
|
+
"types": "./chaos.d.ts",
|
|
37
|
+
"import": "./chaos.js",
|
|
38
|
+
"default": "./chaos.js"
|
|
39
|
+
},
|
|
40
|
+
"./chaos.js": {
|
|
41
|
+
"types": "./chaos.d.ts",
|
|
42
|
+
"import": "./chaos.js",
|
|
43
|
+
"default": "./chaos.js"
|
|
44
|
+
},
|
|
45
|
+
"./ecs": {
|
|
46
|
+
"types": "./ecs.d.ts",
|
|
47
|
+
"import": "./ecs.js",
|
|
48
|
+
"default": "./ecs.js"
|
|
49
|
+
},
|
|
50
|
+
"./ecs.js": {
|
|
51
|
+
"types": "./ecs.d.ts",
|
|
52
|
+
"import": "./ecs.js",
|
|
53
|
+
"default": "./ecs.js"
|
|
54
|
+
},
|
|
55
|
+
"./env": {
|
|
56
|
+
"types": "./env.d.ts",
|
|
57
|
+
"import": "./env.js",
|
|
58
|
+
"default": "./env.js"
|
|
59
|
+
},
|
|
60
|
+
"./env.js": {
|
|
61
|
+
"types": "./env.d.ts",
|
|
62
|
+
"import": "./env.js",
|
|
63
|
+
"default": "./env.js"
|
|
64
|
+
},
|
|
65
|
+
"./gitlab": {
|
|
66
|
+
"types": "./gitlab.d.ts",
|
|
67
|
+
"import": "./gitlab.js",
|
|
68
|
+
"default": "./gitlab.js"
|
|
69
|
+
},
|
|
70
|
+
"./gitlab.js": {
|
|
71
|
+
"types": "./gitlab.d.ts",
|
|
72
|
+
"import": "./gitlab.js",
|
|
73
|
+
"default": "./gitlab.js"
|
|
74
|
+
},
|
|
75
|
+
"./index": {
|
|
76
|
+
"types": "./index.d.ts",
|
|
77
|
+
"import": "./index.js",
|
|
78
|
+
"default": "./index.js"
|
|
79
|
+
},
|
|
80
|
+
"./index.js": {
|
|
81
|
+
"types": "./index.d.ts",
|
|
82
|
+
"import": "./index.js",
|
|
83
|
+
"default": "./index.js"
|
|
84
|
+
},
|
|
85
|
+
"./localstack": {
|
|
86
|
+
"types": "./localstack.d.ts",
|
|
87
|
+
"import": "./localstack.js",
|
|
88
|
+
"default": "./localstack.js"
|
|
89
|
+
},
|
|
90
|
+
"./localstack.js": {
|
|
91
|
+
"types": "./localstack.d.ts",
|
|
92
|
+
"import": "./localstack.js",
|
|
93
|
+
"default": "./localstack.js"
|
|
94
|
+
},
|
|
95
|
+
"./logger": {
|
|
96
|
+
"types": "./logger.d.ts",
|
|
97
|
+
"import": "./logger.js",
|
|
98
|
+
"default": "./logger.js"
|
|
99
|
+
},
|
|
100
|
+
"./logger.js": {
|
|
101
|
+
"types": "./logger.d.ts",
|
|
102
|
+
"import": "./logger.js",
|
|
103
|
+
"default": "./logger.js"
|
|
104
|
+
},
|
|
105
|
+
"./server": {
|
|
106
|
+
"types": "./server.d.ts",
|
|
107
|
+
"import": "./server.js",
|
|
108
|
+
"default": "./server.js"
|
|
109
|
+
},
|
|
110
|
+
"./server.js": {
|
|
111
|
+
"types": "./server.d.ts",
|
|
112
|
+
"import": "./server.js",
|
|
113
|
+
"default": "./server.js"
|
|
114
|
+
},
|
|
115
|
+
"./stage": {
|
|
116
|
+
"types": "./stage.d.ts",
|
|
117
|
+
"import": "./stage.js",
|
|
118
|
+
"default": "./stage.js"
|
|
119
|
+
},
|
|
120
|
+
"./stage.js": {
|
|
121
|
+
"types": "./stage.d.ts",
|
|
122
|
+
"import": "./stage.js",
|
|
123
|
+
"default": "./stage.js"
|
|
124
|
+
},
|
|
125
|
+
"./types": {
|
|
126
|
+
"types": "./types.d.ts",
|
|
127
|
+
"import": "./types.js",
|
|
128
|
+
"default": "./types.js"
|
|
129
|
+
},
|
|
130
|
+
"./types.js": {
|
|
131
|
+
"types": "./types.d.ts",
|
|
132
|
+
"import": "./types.js",
|
|
133
|
+
"default": "./types.js"
|
|
134
|
+
},
|
|
135
|
+
"./vpc": {
|
|
136
|
+
"types": "./vpc.d.ts",
|
|
137
|
+
"import": "./vpc.js",
|
|
138
|
+
"default": "./vpc.js"
|
|
139
|
+
},
|
|
140
|
+
"./vpc.js": {
|
|
141
|
+
"types": "./vpc.d.ts",
|
|
142
|
+
"import": "./vpc.js",
|
|
143
|
+
"default": "./vpc.js"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
package/stage.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GetEnvWithValue, Stage, IsStage } from './types.js';
|
|
2
|
+
export declare const getStage: GetEnvWithValue<Stage>;
|
|
3
|
+
export declare const LOCAL = Stage.Local;
|
|
4
|
+
export declare const isLocal: IsStage;
|
|
5
|
+
export declare const DEV = Stage.Dev;
|
|
6
|
+
export declare const isDev: IsStage;
|
|
7
|
+
export declare const DEVELOP = Stage.Develop;
|
|
8
|
+
export declare const isDevelop: IsStage;
|
|
9
|
+
export declare const TEST = Stage.Test;
|
|
10
|
+
export declare const isTest: IsStage;
|
|
11
|
+
export declare const TESTING = Stage.Testing;
|
|
12
|
+
export declare const isTesting: IsStage;
|
|
13
|
+
export declare const QA = Stage.Qa;
|
|
14
|
+
export declare const isQa: IsStage;
|
|
15
|
+
export declare const UAT = Stage.Uat;
|
|
16
|
+
export declare const isUat: IsStage;
|
|
17
|
+
export declare const STAGING = Stage.Staging;
|
|
18
|
+
export declare const isStaging: IsStage;
|
|
19
|
+
export declare const PREPROD = Stage.PreProd;
|
|
20
|
+
export declare const isPreProd: IsStage;
|
|
21
|
+
export declare const PREPRODUCTION = Stage.PreProduction;
|
|
22
|
+
export declare const isPreProduction: IsStage;
|
|
23
|
+
export declare const FEATURE = Stage.Feature;
|
|
24
|
+
export declare const isFeature: IsStage;
|
|
25
|
+
export declare const HOTFIX = Stage.Hotfix;
|
|
26
|
+
export declare const isHotfix: IsStage;
|
|
27
|
+
export declare const PRODUCTION = Stage.Production;
|
|
28
|
+
export declare const isProduction: IsStage;
|
package/stage.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getEnv } from './env.js';
|
|
2
|
+
import { Stage } from './types.js';
|
|
3
|
+
export const getStage = () => getEnv('STAGE', Stage.Local);
|
|
4
|
+
export const LOCAL = Stage.Local;
|
|
5
|
+
export const isLocal = () => getStage() === Stage.Local;
|
|
6
|
+
export const DEV = Stage.Dev;
|
|
7
|
+
export const isDev = () => getStage() === Stage.Dev;
|
|
8
|
+
export const DEVELOP = Stage.Develop;
|
|
9
|
+
export const isDevelop = () => getStage() === Stage.Develop;
|
|
10
|
+
export const TEST = Stage.Test;
|
|
11
|
+
export const isTest = () => getStage() === Stage.Test;
|
|
12
|
+
export const TESTING = Stage.Testing;
|
|
13
|
+
export const isTesting = () => getStage() === Stage.Testing;
|
|
14
|
+
export const QA = Stage.Qa;
|
|
15
|
+
export const isQa = () => getStage() === Stage.Qa;
|
|
16
|
+
export const UAT = Stage.Uat;
|
|
17
|
+
export const isUat = () => getStage() === Stage.Uat;
|
|
18
|
+
export const STAGING = Stage.Staging;
|
|
19
|
+
export const isStaging = () => getStage() === Stage.Staging;
|
|
20
|
+
export const PREPROD = Stage.PreProd;
|
|
21
|
+
export const isPreProd = () => getStage() === Stage.PreProd;
|
|
22
|
+
export const PREPRODUCTION = Stage.PreProduction;
|
|
23
|
+
export const isPreProduction = () => getStage() === Stage.PreProduction;
|
|
24
|
+
export const FEATURE = Stage.Feature;
|
|
25
|
+
export const isFeature = () => getStage() === Stage.Feature;
|
|
26
|
+
export const HOTFIX = Stage.Hotfix;
|
|
27
|
+
export const isHotfix = () => getStage() === Stage.Hotfix;
|
|
28
|
+
export const PRODUCTION = Stage.Production;
|
|
29
|
+
export const isProduction = () => getStage() === Stage.Production;
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type GetEnv = {
|
|
2
|
+
(name: string): string | never;
|
|
3
|
+
<T extends string>(name: string): T | never;
|
|
4
|
+
<T extends string>(name: string, defaultValue: T): T;
|
|
5
|
+
};
|
|
6
|
+
export type ExistsEnv = (name: string) => boolean;
|
|
7
|
+
export type GetEnvWithValue<T extends string = string> = () => T;
|
|
8
|
+
export type GetBooleanEnvWithValue = () => boolean;
|
|
9
|
+
export type GetNumberEnvWithValue = () => number;
|
|
10
|
+
export type NodeEnv = 'production' | 'development' | 'test';
|
|
11
|
+
export type GetNodeEnv = () => NodeEnv;
|
|
12
|
+
export type IsNodeEnv = () => boolean;
|
|
13
|
+
export type IsStage = () => boolean;
|
|
14
|
+
export declare enum AwsRegion {
|
|
15
|
+
UsEast1 = "us-east-1",
|
|
16
|
+
UsEast2 = "us-east-2",
|
|
17
|
+
UsWest1 = "us-west-1",
|
|
18
|
+
UsWest2 = "us-west-2",
|
|
19
|
+
CaCentral1 = "ca-central-1",
|
|
20
|
+
CaWest1 = "ca-west-1",
|
|
21
|
+
MxCentral1 = "mx-central-1",
|
|
22
|
+
SaEast1 = "sa-east-1",
|
|
23
|
+
EuWest1 = "eu-west-1",
|
|
24
|
+
EuWest2 = "eu-west-2",
|
|
25
|
+
EuWest3 = "eu-west-3",
|
|
26
|
+
EuCentral1 = "eu-central-1",
|
|
27
|
+
EuCentral2 = "eu-central-2",
|
|
28
|
+
EuNorth1 = "eu-north-1",
|
|
29
|
+
EuSouth1 = "eu-south-1",
|
|
30
|
+
EuSouth2 = "eu-south-2",
|
|
31
|
+
MeSouth1 = "me-south-1",
|
|
32
|
+
MeCentral1 = "me-central-1",
|
|
33
|
+
AfSouth1 = "af-south-1",
|
|
34
|
+
IlCentral1 = "il-central-1",
|
|
35
|
+
ApNorthEast1 = "ap-northeast-1",
|
|
36
|
+
ApNorthEast2 = "ap-northeast-2",
|
|
37
|
+
ApNorthEast3 = "ap-northeast-3",
|
|
38
|
+
ApSouth1 = "ap-south-1",
|
|
39
|
+
ApSouth2 = "ap-south-2",
|
|
40
|
+
ApEast1 = "ap-east-1",
|
|
41
|
+
ApEast2 = "ap-east-2",
|
|
42
|
+
ApSouthEast1 = "ap-southeast-1",
|
|
43
|
+
ApSouthEast2 = "ap-southeast-2",
|
|
44
|
+
ApSouthEast3 = "ap-southeast-3",
|
|
45
|
+
ApSouthEast4 = "ap-southeast-4",
|
|
46
|
+
ApSouthEast5 = "ap-southeast-5",
|
|
47
|
+
ApSouthEast6 = "ap-southeast-6",
|
|
48
|
+
ApSouthEast7 = "ap-southeast-7",
|
|
49
|
+
UsGovWest1 = "us-gov-west-1",
|
|
50
|
+
UsGovEast1 = "us-gov-east-1",
|
|
51
|
+
CnNorth1 = "cn-north-1",
|
|
52
|
+
CnNorthWest1 = "cn-northwest-1"
|
|
53
|
+
}
|
|
54
|
+
export declare enum Stage {
|
|
55
|
+
Local = "local",
|
|
56
|
+
Dev = "dev",
|
|
57
|
+
Develop = "develop",
|
|
58
|
+
Test = "test",
|
|
59
|
+
Testing = "testing",
|
|
60
|
+
Qa = "qa",
|
|
61
|
+
Uat = "uat",
|
|
62
|
+
Staging = "staging",
|
|
63
|
+
PreProduction = "pre-production",
|
|
64
|
+
PreProd = "preprod",
|
|
65
|
+
Feature = "feature",
|
|
66
|
+
Hotfix = "hotfix",
|
|
67
|
+
Production = "production"
|
|
68
|
+
}
|
package/types.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export var AwsRegion;
|
|
2
|
+
(function (AwsRegion) {
|
|
3
|
+
AwsRegion["UsEast1"] = "us-east-1";
|
|
4
|
+
AwsRegion["UsEast2"] = "us-east-2";
|
|
5
|
+
AwsRegion["UsWest1"] = "us-west-1";
|
|
6
|
+
AwsRegion["UsWest2"] = "us-west-2";
|
|
7
|
+
AwsRegion["CaCentral1"] = "ca-central-1";
|
|
8
|
+
AwsRegion["CaWest1"] = "ca-west-1";
|
|
9
|
+
AwsRegion["MxCentral1"] = "mx-central-1";
|
|
10
|
+
AwsRegion["SaEast1"] = "sa-east-1";
|
|
11
|
+
AwsRegion["EuWest1"] = "eu-west-1";
|
|
12
|
+
AwsRegion["EuWest2"] = "eu-west-2";
|
|
13
|
+
AwsRegion["EuWest3"] = "eu-west-3";
|
|
14
|
+
AwsRegion["EuCentral1"] = "eu-central-1";
|
|
15
|
+
AwsRegion["EuCentral2"] = "eu-central-2";
|
|
16
|
+
AwsRegion["EuNorth1"] = "eu-north-1";
|
|
17
|
+
AwsRegion["EuSouth1"] = "eu-south-1";
|
|
18
|
+
AwsRegion["EuSouth2"] = "eu-south-2";
|
|
19
|
+
AwsRegion["MeSouth1"] = "me-south-1";
|
|
20
|
+
AwsRegion["MeCentral1"] = "me-central-1";
|
|
21
|
+
AwsRegion["AfSouth1"] = "af-south-1";
|
|
22
|
+
AwsRegion["IlCentral1"] = "il-central-1";
|
|
23
|
+
AwsRegion["ApNorthEast1"] = "ap-northeast-1";
|
|
24
|
+
AwsRegion["ApNorthEast2"] = "ap-northeast-2";
|
|
25
|
+
AwsRegion["ApNorthEast3"] = "ap-northeast-3";
|
|
26
|
+
AwsRegion["ApSouth1"] = "ap-south-1";
|
|
27
|
+
AwsRegion["ApSouth2"] = "ap-south-2";
|
|
28
|
+
AwsRegion["ApEast1"] = "ap-east-1";
|
|
29
|
+
AwsRegion["ApEast2"] = "ap-east-2";
|
|
30
|
+
AwsRegion["ApSouthEast1"] = "ap-southeast-1";
|
|
31
|
+
AwsRegion["ApSouthEast2"] = "ap-southeast-2";
|
|
32
|
+
AwsRegion["ApSouthEast3"] = "ap-southeast-3";
|
|
33
|
+
AwsRegion["ApSouthEast4"] = "ap-southeast-4";
|
|
34
|
+
AwsRegion["ApSouthEast5"] = "ap-southeast-5";
|
|
35
|
+
AwsRegion["ApSouthEast6"] = "ap-southeast-6";
|
|
36
|
+
AwsRegion["ApSouthEast7"] = "ap-southeast-7";
|
|
37
|
+
AwsRegion["UsGovWest1"] = "us-gov-west-1";
|
|
38
|
+
AwsRegion["UsGovEast1"] = "us-gov-east-1";
|
|
39
|
+
AwsRegion["CnNorth1"] = "cn-north-1";
|
|
40
|
+
AwsRegion["CnNorthWest1"] = "cn-northwest-1";
|
|
41
|
+
})(AwsRegion || (AwsRegion = {}));
|
|
42
|
+
export var Stage;
|
|
43
|
+
(function (Stage) {
|
|
44
|
+
Stage["Local"] = "local";
|
|
45
|
+
Stage["Dev"] = "dev";
|
|
46
|
+
Stage["Develop"] = "develop";
|
|
47
|
+
Stage["Test"] = "test";
|
|
48
|
+
Stage["Testing"] = "testing";
|
|
49
|
+
Stage["Qa"] = "qa";
|
|
50
|
+
Stage["Uat"] = "uat";
|
|
51
|
+
Stage["Staging"] = "staging";
|
|
52
|
+
Stage["PreProduction"] = "pre-production";
|
|
53
|
+
Stage["PreProd"] = "preprod";
|
|
54
|
+
Stage["Feature"] = "feature";
|
|
55
|
+
Stage["Hotfix"] = "hotfix";
|
|
56
|
+
Stage["Production"] = "production";
|
|
57
|
+
})(Stage || (Stage = {}));
|
package/vpc.d.ts
ADDED
package/vpc.js
ADDED