@robinpath/env 0.1.0 → 0.1.1
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/README.md +90 -90
- package/package.json +15 -3
- package/dist/env.d.ts +0 -100
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -248
- package/dist/env.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
# @robinpath/env
|
|
2
|
-
|
|
3
|
-
> Secure environment variable management with sensitive value redaction and protected system vars
|
|
4
|
-
|
|
5
|
-
   
|
|
6
|
-
|
|
7
|
-
## Why use this module?
|
|
8
|
-
|
|
9
|
-
The `env` module lets you:
|
|
10
|
-
|
|
11
|
-
- Get the value of an environment variable
|
|
12
|
-
- Check if an environment variable exists
|
|
13
|
-
- Get all environment variables (sensitive values are redacted by default)
|
|
14
|
-
- Delete an environment variable (protected system vars cannot be deleted)
|
|
15
|
-
- Mark an environment variable as sensitive (will be redacted in env.all output)
|
|
16
|
-
|
|
17
|
-
All functions are callable directly from RobinPath scripts with a simple, consistent API.
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install @robinpath/env
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Quick Start
|
|
26
|
-
|
|
27
|
-
No credentials needed — start using it right away:
|
|
28
|
-
|
|
29
|
-
```robinpath
|
|
30
|
-
env.set "API_URL" "https://api.example.com"
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Available Functions
|
|
34
|
-
|
|
35
|
-
| Function | Description |
|
|
36
|
-
|----------|-------------|
|
|
37
|
-
| `env.get` | Get the value of an environment variable |
|
|
38
|
-
| `env.set` | Set an environment variable (protected system vars cannot be overwritten) |
|
|
39
|
-
| `env.has` | Check if an environment variable exists |
|
|
40
|
-
| `env.all` | Get all environment variables (sensitive values are redacted by default) |
|
|
41
|
-
| `env.delete` | Delete an environment variable (protected system vars cannot be deleted) |
|
|
42
|
-
| `env.secret` | Mark an environment variable as sensitive (will be redacted in env.all output) |
|
|
43
|
-
| `env.load` | Load environment variables from a .env file (won't override existing or protected vars) |
|
|
44
|
-
|
|
45
|
-
## Examples
|
|
46
|
-
|
|
47
|
-
### Set an environment variable (protected system vars cannot be overwritten)
|
|
48
|
-
|
|
49
|
-
```robinpath
|
|
50
|
-
env.set "API_URL" "https://api.example.com"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Check if an environment variable exists
|
|
54
|
-
|
|
55
|
-
```robinpath
|
|
56
|
-
env.has "NODE_ENV"
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Get all environment variables (sensitive values are redacted by default)
|
|
60
|
-
|
|
61
|
-
```robinpath
|
|
62
|
-
env.all
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Integration with RobinPath
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { RobinPath } from "@wiredwp/robinpath";
|
|
69
|
-
import Module from "@robinpath/env";
|
|
70
|
-
|
|
71
|
-
const rp = new RobinPath();
|
|
72
|
-
rp.registerModule(Module.name, Module.functions);
|
|
73
|
-
rp.registerModuleMeta(Module.name, Module.functionMetadata);
|
|
74
|
-
|
|
75
|
-
const result = await rp.executeScript(`
|
|
76
|
-
env.set "API_URL" "https://api.example.com"
|
|
77
|
-
`);
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Full API Reference
|
|
81
|
-
|
|
82
|
-
See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
|
|
83
|
-
|
|
84
|
-
## Related Modules
|
|
85
|
-
|
|
86
|
-
- [`@robinpath/json`](../json) — JSON module for complementary functionality
|
|
87
|
-
|
|
88
|
-
## License
|
|
89
|
-
|
|
90
|
-
MIT
|
|
1
|
+
# @robinpath/env
|
|
2
|
+
|
|
3
|
+
> Secure environment variable management with sensitive value redaction and protected system vars
|
|
4
|
+
|
|
5
|
+
   
|
|
6
|
+
|
|
7
|
+
## Why use this module?
|
|
8
|
+
|
|
9
|
+
The `env` module lets you:
|
|
10
|
+
|
|
11
|
+
- Get the value of an environment variable
|
|
12
|
+
- Check if an environment variable exists
|
|
13
|
+
- Get all environment variables (sensitive values are redacted by default)
|
|
14
|
+
- Delete an environment variable (protected system vars cannot be deleted)
|
|
15
|
+
- Mark an environment variable as sensitive (will be redacted in env.all output)
|
|
16
|
+
|
|
17
|
+
All functions are callable directly from RobinPath scripts with a simple, consistent API.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @robinpath/env
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
No credentials needed — start using it right away:
|
|
28
|
+
|
|
29
|
+
```robinpath
|
|
30
|
+
env.set "API_URL" "https://api.example.com"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Available Functions
|
|
34
|
+
|
|
35
|
+
| Function | Description |
|
|
36
|
+
|----------|-------------|
|
|
37
|
+
| `env.get` | Get the value of an environment variable |
|
|
38
|
+
| `env.set` | Set an environment variable (protected system vars cannot be overwritten) |
|
|
39
|
+
| `env.has` | Check if an environment variable exists |
|
|
40
|
+
| `env.all` | Get all environment variables (sensitive values are redacted by default) |
|
|
41
|
+
| `env.delete` | Delete an environment variable (protected system vars cannot be deleted) |
|
|
42
|
+
| `env.secret` | Mark an environment variable as sensitive (will be redacted in env.all output) |
|
|
43
|
+
| `env.load` | Load environment variables from a .env file (won't override existing or protected vars) |
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
### Set an environment variable (protected system vars cannot be overwritten)
|
|
48
|
+
|
|
49
|
+
```robinpath
|
|
50
|
+
env.set "API_URL" "https://api.example.com"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Check if an environment variable exists
|
|
54
|
+
|
|
55
|
+
```robinpath
|
|
56
|
+
env.has "NODE_ENV"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Get all environment variables (sensitive values are redacted by default)
|
|
60
|
+
|
|
61
|
+
```robinpath
|
|
62
|
+
env.all
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Integration with RobinPath
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { RobinPath } from "@wiredwp/robinpath";
|
|
69
|
+
import Module from "@robinpath/env";
|
|
70
|
+
|
|
71
|
+
const rp = new RobinPath();
|
|
72
|
+
rp.registerModule(Module.name, Module.functions);
|
|
73
|
+
rp.registerModuleMeta(Module.name, Module.functionMetadata);
|
|
74
|
+
|
|
75
|
+
const result = await rp.executeScript(`
|
|
76
|
+
env.set "API_URL" "https://api.example.com"
|
|
77
|
+
`);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Full API Reference
|
|
81
|
+
|
|
82
|
+
See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
|
|
83
|
+
|
|
84
|
+
## Related Modules
|
|
85
|
+
|
|
86
|
+
- [`@robinpath/json`](../json) — JSON module for complementary functionality
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robinpath/env",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,11 +21,23 @@
|
|
|
21
21
|
"test": "node --import tsx --test tests/*.test.ts"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@
|
|
24
|
+
"@robinpath/core": ">=0.20.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
27
|
+
"@robinpath/core": "^0.30.1",
|
|
28
28
|
"tsx": "^4.19.0",
|
|
29
29
|
"typescript": "^5.6.0"
|
|
30
|
+
},
|
|
31
|
+
"description": "Secure environment variable management with sensitive value redaction and protected system vars",
|
|
32
|
+
"keywords": [
|
|
33
|
+
"env",
|
|
34
|
+
"other"
|
|
35
|
+
],
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"robinpath": {
|
|
38
|
+
"category": "other",
|
|
39
|
+
"type": "utility",
|
|
40
|
+
"auth": "none",
|
|
41
|
+
"functionCount": 7
|
|
30
42
|
}
|
|
31
43
|
}
|
package/dist/env.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type { BuiltinHandler } from "@wiredwp/robinpath";
|
|
2
|
-
export declare const EnvFunctions: Record<string, BuiltinHandler>;
|
|
3
|
-
export declare const EnvFunctionMetadata: {
|
|
4
|
-
get: {
|
|
5
|
-
description: string;
|
|
6
|
-
parameters: {
|
|
7
|
-
name: string;
|
|
8
|
-
dataType: string;
|
|
9
|
-
description: string;
|
|
10
|
-
formInputType: string;
|
|
11
|
-
required: boolean;
|
|
12
|
-
}[];
|
|
13
|
-
returnType: string;
|
|
14
|
-
returnDescription: string;
|
|
15
|
-
example: string;
|
|
16
|
-
};
|
|
17
|
-
set: {
|
|
18
|
-
description: string;
|
|
19
|
-
parameters: {
|
|
20
|
-
name: string;
|
|
21
|
-
dataType: string;
|
|
22
|
-
description: string;
|
|
23
|
-
formInputType: string;
|
|
24
|
-
required: boolean;
|
|
25
|
-
}[];
|
|
26
|
-
returnType: string;
|
|
27
|
-
returnDescription: string;
|
|
28
|
-
example: string;
|
|
29
|
-
};
|
|
30
|
-
has: {
|
|
31
|
-
description: string;
|
|
32
|
-
parameters: {
|
|
33
|
-
name: string;
|
|
34
|
-
dataType: string;
|
|
35
|
-
description: string;
|
|
36
|
-
formInputType: string;
|
|
37
|
-
required: boolean;
|
|
38
|
-
}[];
|
|
39
|
-
returnType: string;
|
|
40
|
-
returnDescription: string;
|
|
41
|
-
example: string;
|
|
42
|
-
};
|
|
43
|
-
all: {
|
|
44
|
-
description: string;
|
|
45
|
-
parameters: {
|
|
46
|
-
name: string;
|
|
47
|
-
dataType: string;
|
|
48
|
-
description: string;
|
|
49
|
-
formInputType: string;
|
|
50
|
-
required: boolean;
|
|
51
|
-
}[];
|
|
52
|
-
returnType: string;
|
|
53
|
-
returnDescription: string;
|
|
54
|
-
example: string;
|
|
55
|
-
};
|
|
56
|
-
delete: {
|
|
57
|
-
description: string;
|
|
58
|
-
parameters: {
|
|
59
|
-
name: string;
|
|
60
|
-
dataType: string;
|
|
61
|
-
description: string;
|
|
62
|
-
formInputType: string;
|
|
63
|
-
required: boolean;
|
|
64
|
-
}[];
|
|
65
|
-
returnType: string;
|
|
66
|
-
returnDescription: string;
|
|
67
|
-
example: string;
|
|
68
|
-
};
|
|
69
|
-
secret: {
|
|
70
|
-
description: string;
|
|
71
|
-
parameters: {
|
|
72
|
-
name: string;
|
|
73
|
-
dataType: string;
|
|
74
|
-
description: string;
|
|
75
|
-
formInputType: string;
|
|
76
|
-
required: boolean;
|
|
77
|
-
}[];
|
|
78
|
-
returnType: string;
|
|
79
|
-
returnDescription: string;
|
|
80
|
-
example: string;
|
|
81
|
-
};
|
|
82
|
-
load: {
|
|
83
|
-
description: string;
|
|
84
|
-
parameters: {
|
|
85
|
-
name: string;
|
|
86
|
-
dataType: string;
|
|
87
|
-
description: string;
|
|
88
|
-
formInputType: string;
|
|
89
|
-
required: boolean;
|
|
90
|
-
}[];
|
|
91
|
-
returnType: string;
|
|
92
|
-
returnDescription: string;
|
|
93
|
-
example: string;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
export declare const EnvModuleMetadata: {
|
|
97
|
-
description: string;
|
|
98
|
-
methods: string[];
|
|
99
|
-
};
|
|
100
|
-
//# sourceMappingURL=env.d.ts.map
|
package/dist/env.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,oBAAoB,CAAC;AA8H3F,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAQvD,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwH/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC"}
|
package/dist/env.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
// -- Security: Sensitive key tracking & validation ----------------------
|
|
3
|
-
const sensitiveKeys = new Set();
|
|
4
|
-
const SENSITIVE_PATTERNS = [
|
|
5
|
-
/KEY$/i, /SECRET$/i, /PASSWORD$/i, /PASS$/i, /TOKEN$/i, /AUTH$/i,
|
|
6
|
-
/CREDENTIAL/i, /PRIVATE/i, /API_KEY/i, /ACCESS_KEY/i, /SESSION/i,
|
|
7
|
-
];
|
|
8
|
-
const PROTECTED_KEYS = new Set([
|
|
9
|
-
"PATH", "HOME", "USER", "SHELL", "TERM", "LANG",
|
|
10
|
-
"NODE_OPTIONS", "NODE_PATH", "LD_PRELOAD", "LD_LIBRARY_PATH",
|
|
11
|
-
"DYLD_INSERT_LIBRARIES", "DYLD_LIBRARY_PATH",
|
|
12
|
-
]);
|
|
13
|
-
const VALID_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
14
|
-
const REDACTED = "***";
|
|
15
|
-
function isSensitive(key) {
|
|
16
|
-
if (sensitiveKeys.has(key))
|
|
17
|
-
return true;
|
|
18
|
-
return SENSITIVE_PATTERNS.some((p) => p.test(key));
|
|
19
|
-
}
|
|
20
|
-
function validateKey(key) {
|
|
21
|
-
if (!key)
|
|
22
|
-
throw new Error("Environment variable name cannot be empty");
|
|
23
|
-
if (!VALID_KEY.test(key))
|
|
24
|
-
throw new Error(`Invalid environment variable name: "${key}". Must match /^[A-Za-z_][A-Za-z0-9_]*$/`);
|
|
25
|
-
}
|
|
26
|
-
// -- RobinPath Function Handlers ----------------------------------------
|
|
27
|
-
const get = (args) => {
|
|
28
|
-
const name = String(args[0] ?? "");
|
|
29
|
-
validateKey(name);
|
|
30
|
-
const defaultValue = args[1] !== undefined ? String(args[1]) : null;
|
|
31
|
-
const value = process.env[name];
|
|
32
|
-
if (value === undefined)
|
|
33
|
-
return defaultValue;
|
|
34
|
-
return value;
|
|
35
|
-
};
|
|
36
|
-
const set = (args) => {
|
|
37
|
-
const name = String(args[0] ?? "");
|
|
38
|
-
const value = String(args[1] ?? "");
|
|
39
|
-
validateKey(name);
|
|
40
|
-
if (PROTECTED_KEYS.has(name))
|
|
41
|
-
throw new Error(`Cannot overwrite protected system variable: "${name}"`);
|
|
42
|
-
process.env[name] = value;
|
|
43
|
-
return true;
|
|
44
|
-
};
|
|
45
|
-
const has = (args) => {
|
|
46
|
-
const name = String(args[0] ?? "");
|
|
47
|
-
validateKey(name);
|
|
48
|
-
return name in process.env && process.env[name] !== undefined;
|
|
49
|
-
};
|
|
50
|
-
const all = (args) => {
|
|
51
|
-
const showSensitive = args[0] === true;
|
|
52
|
-
const result = {};
|
|
53
|
-
for (const [key, value] of Object.entries(process.env)) {
|
|
54
|
-
if (value === undefined)
|
|
55
|
-
continue;
|
|
56
|
-
result[key] = (!showSensitive && isSensitive(key)) ? REDACTED : value;
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
};
|
|
60
|
-
const del = (args) => {
|
|
61
|
-
const name = String(args[0] ?? "");
|
|
62
|
-
validateKey(name);
|
|
63
|
-
if (PROTECTED_KEYS.has(name))
|
|
64
|
-
throw new Error(`Cannot delete protected system variable: "${name}"`);
|
|
65
|
-
delete process.env[name];
|
|
66
|
-
return true;
|
|
67
|
-
};
|
|
68
|
-
const secret = (args) => {
|
|
69
|
-
const name = String(args[0] ?? "");
|
|
70
|
-
validateKey(name);
|
|
71
|
-
sensitiveKeys.add(name);
|
|
72
|
-
return true;
|
|
73
|
-
};
|
|
74
|
-
const load = (args) => {
|
|
75
|
-
const filePath = String(args[0] ?? ".env");
|
|
76
|
-
const content = readFileSync(filePath, "utf-8");
|
|
77
|
-
const lines = content.split(/\r?\n/);
|
|
78
|
-
let count = 0;
|
|
79
|
-
for (const rawLine of lines) {
|
|
80
|
-
const trimmed = rawLine.trim();
|
|
81
|
-
if (trimmed === "" || trimmed.startsWith("#"))
|
|
82
|
-
continue;
|
|
83
|
-
const eqIndex = trimmed.indexOf("=");
|
|
84
|
-
if (eqIndex === -1)
|
|
85
|
-
continue;
|
|
86
|
-
const key = trimmed.slice(0, eqIndex).trim();
|
|
87
|
-
if (key === "" || !VALID_KEY.test(key))
|
|
88
|
-
continue;
|
|
89
|
-
let value = trimmed.slice(eqIndex + 1);
|
|
90
|
-
if ((value.startsWith('"') && value.includes('"', 1)) ||
|
|
91
|
-
(value.startsWith("'") && value.includes("'", 1))) {
|
|
92
|
-
const quote = value[0];
|
|
93
|
-
const closingIndex = value.indexOf(quote, 1);
|
|
94
|
-
if (closingIndex !== -1) {
|
|
95
|
-
value = value.slice(1, closingIndex);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
const commentIndex = value.indexOf(" #");
|
|
100
|
-
if (commentIndex !== -1) {
|
|
101
|
-
value = value.slice(0, commentIndex);
|
|
102
|
-
}
|
|
103
|
-
value = value.trim();
|
|
104
|
-
}
|
|
105
|
-
// Don't override existing env vars, and protect system vars
|
|
106
|
-
if (process.env[key] === undefined && !PROTECTED_KEYS.has(key)) {
|
|
107
|
-
process.env[key] = value;
|
|
108
|
-
count++;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return count;
|
|
112
|
-
};
|
|
113
|
-
// -- Exports ------------------------------------------------------------
|
|
114
|
-
export const EnvFunctions = {
|
|
115
|
-
get,
|
|
116
|
-
set,
|
|
117
|
-
has,
|
|
118
|
-
all,
|
|
119
|
-
delete: del,
|
|
120
|
-
secret,
|
|
121
|
-
load,
|
|
122
|
-
};
|
|
123
|
-
export const EnvFunctionMetadata = {
|
|
124
|
-
get: {
|
|
125
|
-
description: "Get the value of an environment variable",
|
|
126
|
-
parameters: [
|
|
127
|
-
{
|
|
128
|
-
name: "name",
|
|
129
|
-
dataType: "string",
|
|
130
|
-
description: "Name of the environment variable",
|
|
131
|
-
formInputType: "text",
|
|
132
|
-
required: true,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: "defaultValue",
|
|
136
|
-
dataType: "string",
|
|
137
|
-
description: "Default value if the variable is not set",
|
|
138
|
-
formInputType: "text",
|
|
139
|
-
required: false,
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
returnType: "string",
|
|
143
|
-
returnDescription: "The environment variable value, the default value, or null if not set",
|
|
144
|
-
example: 'env.get "NODE_ENV"',
|
|
145
|
-
},
|
|
146
|
-
set: {
|
|
147
|
-
description: "Set an environment variable (protected system vars cannot be overwritten)",
|
|
148
|
-
parameters: [
|
|
149
|
-
{
|
|
150
|
-
name: "name",
|
|
151
|
-
dataType: "string",
|
|
152
|
-
description: "Name of the environment variable (must match [A-Za-z_][A-Za-z0-9_]*)",
|
|
153
|
-
formInputType: "text",
|
|
154
|
-
required: true,
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "value",
|
|
158
|
-
dataType: "string",
|
|
159
|
-
description: "Value to set",
|
|
160
|
-
formInputType: "text",
|
|
161
|
-
required: true,
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
returnType: "boolean",
|
|
165
|
-
returnDescription: "True if the variable was set",
|
|
166
|
-
example: 'env.set "API_URL" "https://api.example.com"',
|
|
167
|
-
},
|
|
168
|
-
has: {
|
|
169
|
-
description: "Check if an environment variable exists",
|
|
170
|
-
parameters: [
|
|
171
|
-
{
|
|
172
|
-
name: "name",
|
|
173
|
-
dataType: "string",
|
|
174
|
-
description: "Name of the environment variable",
|
|
175
|
-
formInputType: "text",
|
|
176
|
-
required: true,
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
returnType: "boolean",
|
|
180
|
-
returnDescription: "True if the variable exists, false otherwise",
|
|
181
|
-
example: 'env.has "NODE_ENV"',
|
|
182
|
-
},
|
|
183
|
-
all: {
|
|
184
|
-
description: "Get all environment variables (sensitive values are redacted by default)",
|
|
185
|
-
parameters: [
|
|
186
|
-
{
|
|
187
|
-
name: "showSensitive",
|
|
188
|
-
dataType: "boolean",
|
|
189
|
-
description: "Pass true to show sensitive values unredacted (default: false)",
|
|
190
|
-
formInputType: "text",
|
|
191
|
-
required: false,
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
returnType: "object",
|
|
195
|
-
returnDescription: "Object with all environment variable key-value pairs (secrets shown as ***)",
|
|
196
|
-
example: "env.all",
|
|
197
|
-
},
|
|
198
|
-
delete: {
|
|
199
|
-
description: "Delete an environment variable (protected system vars cannot be deleted)",
|
|
200
|
-
parameters: [
|
|
201
|
-
{
|
|
202
|
-
name: "name",
|
|
203
|
-
dataType: "string",
|
|
204
|
-
description: "Name of the environment variable to delete",
|
|
205
|
-
formInputType: "text",
|
|
206
|
-
required: true,
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
returnType: "boolean",
|
|
210
|
-
returnDescription: "True if the variable was deleted",
|
|
211
|
-
example: 'env.delete "OLD_KEY"',
|
|
212
|
-
},
|
|
213
|
-
secret: {
|
|
214
|
-
description: "Mark an environment variable as sensitive (will be redacted in env.all output)",
|
|
215
|
-
parameters: [
|
|
216
|
-
{
|
|
217
|
-
name: "name",
|
|
218
|
-
dataType: "string",
|
|
219
|
-
description: "Name of the environment variable to mark as sensitive",
|
|
220
|
-
formInputType: "text",
|
|
221
|
-
required: true,
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
returnType: "boolean",
|
|
225
|
-
returnDescription: "True if marked",
|
|
226
|
-
example: 'env.secret "SMTP_PASS"',
|
|
227
|
-
},
|
|
228
|
-
load: {
|
|
229
|
-
description: "Load environment variables from a .env file (won't override existing or protected vars)",
|
|
230
|
-
parameters: [
|
|
231
|
-
{
|
|
232
|
-
name: "path",
|
|
233
|
-
dataType: "string",
|
|
234
|
-
description: "Path to the .env file",
|
|
235
|
-
formInputType: "text",
|
|
236
|
-
required: true,
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
returnType: "number",
|
|
240
|
-
returnDescription: "Number of new variables loaded",
|
|
241
|
-
example: 'env.load ".env"',
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
export const EnvModuleMetadata = {
|
|
245
|
-
description: "Secure environment variable management with sensitive value redaction and protected system vars",
|
|
246
|
-
methods: ["get", "set", "has", "all", "delete", "secret", "load"],
|
|
247
|
-
};
|
|
248
|
-
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,0EAA0E;AAE1E,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;AACxC,MAAM,kBAAkB,GAAG;IACzB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAChE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU;CACjE,CAAC;AACF,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAC/C,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB;IAC5D,uBAAuB,EAAE,mBAAmB;CAC7C,CAAC,CAAC;AACH,MAAM,SAAS,GAAG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EF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,iGAAiG;IAC9G,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;CAClE,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ModuleAdapter } from "@wiredwp/robinpath";
|
|
2
|
-
declare const EnvModule: ModuleAdapter;
|
|
3
|
-
export default EnvModule;
|
|
4
|
-
export { EnvModule };
|
|
5
|
-
export { EnvFunctions, EnvFunctionMetadata, EnvModuleMetadata } from "./env.js";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,QAAA,MAAM,SAAS,EAAE,aAMhB,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EnvFunctions, EnvFunctionMetadata, EnvModuleMetadata } from "./env.js";
|
|
2
|
-
const EnvModule = {
|
|
3
|
-
name: "env",
|
|
4
|
-
functions: EnvFunctions,
|
|
5
|
-
functionMetadata: EnvFunctionMetadata,
|
|
6
|
-
moduleMetadata: EnvModuleMetadata,
|
|
7
|
-
global: false,
|
|
8
|
-
}; // as ModuleAdapter
|
|
9
|
-
export default EnvModule;
|
|
10
|
-
export { EnvModule };
|
|
11
|
-
export { EnvFunctions, EnvFunctionMetadata, EnvModuleMetadata } from "./env.js";
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEhF,MAAM,SAAS,GAAkB;IAC/B,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,YAAY;IACvB,gBAAgB,EAAE,mBAA0B;IAC5C,cAAc,EAAE,iBAAwB;IACxC,MAAM,EAAE,KAAK;CACd,CAAC,CAAC,mBAAmB;AAEtB,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|