envilder 0.5.1 โ 0.5.2
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 +80 -29
- package/lib/cli/cli.js +0 -0
- package/package.json +22 -5
package/README.md
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
2
|
<br>
|
|
3
3
|
<img src="https://github.com/user-attachments/assets/96bf1efa-7d21-440a-a414-3a20e7f9a1f1" alt="Envilder">
|
|
4
|
-
<br>
|
|
5
|
-
Envilder
|
|
6
|
-
<br>
|
|
7
4
|
</h1>
|
|
8
5
|
|
|
9
|
-
<h4 align="center">
|
|
6
|
+
<h4 align="center">A CLI that securely centralizes your environment variables from AWS SSM as a single source of truth</h4>
|
|
10
7
|
|
|
11
8
|
<p align="center">
|
|
12
9
|
<a href="https://www.npmjs.com/package/envilder">
|
|
@@ -20,11 +17,16 @@
|
|
|
20
17
|
</a>
|
|
21
18
|
</p>
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
## ๐ Key benefits
|
|
21
|
+
|
|
22
|
+
- **๐ Strict access control** - AWS IAM policies control who accesses which secrets (dev vs prod)
|
|
23
|
+
- **๐ Full audit trail** - All parameter access is logged in CloudTrail for compliance requirements
|
|
24
|
+
- **๐งฉ Single source of truth** - No more copying .env files from Notion or emails - SSM is your only source
|
|
25
|
+
- **๐ Idempotent operations** - Won't overwrite your local values - safe for automation
|
|
26
|
+
- **โ๏ธ Environment-aware** - Use templates like `/project/${ENV}/DB_PASSWORD` to dynamically fetch the right secrets
|
|
27
|
+
- **๐งฑ No extra infrastructure** - Uses AWS SSM's existing reliability instead of additional secret managers
|
|
26
28
|
|
|
27
|
-
## โก Quick
|
|
29
|
+
## โก Quick start
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
32
|
# Install globally
|
|
@@ -37,7 +39,7 @@ echo '{"DB_PASSWORD": "/my-app/db/password"}' > param-map.json
|
|
|
37
39
|
envilder --map=param-map.json --envfile=.env
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
## ๐ค What
|
|
42
|
+
## ๐ค What problem does Envilder solve?
|
|
41
43
|
|
|
42
44
|
<table>
|
|
43
45
|
<tr>
|
|
@@ -72,23 +74,23 @@ envilder --map=param-map.json --envfile=.env
|
|
|
72
74
|
|
|
73
75
|
## ๐ก Why Envilder?
|
|
74
76
|
|
|
75
|
-
- ๐ **No
|
|
76
|
-
- ๐ค **Automate
|
|
77
|
-
- ๐ **Always in
|
|
78
|
-
- ๐๏ธ **Fast to
|
|
79
|
-
- ๐ชถ **Simple but
|
|
77
|
+
- ๐ **No more secrets in git** - Store credentials in AWS SSM Parameter Store instead of version control
|
|
78
|
+
- ๐ค **Automate everything** - One command to generate your `.env` files across all environments
|
|
79
|
+
- ๐ **Always in sync** - Keep your local, dev, and production environments consistent
|
|
80
|
+
- ๐๏ธ **Fast to set up** - Configure once, then generate `.env` files with a single command
|
|
81
|
+
- ๐ชถ **Simple but powerful** - Easy interface with support for encrypted parameters and multiple AWS profiles
|
|
80
82
|
|
|
81
|
-
## ๐ฏ Perfect for
|
|
83
|
+
## ๐ฏ Perfect for teams
|
|
82
84
|
|
|
83
85
|
Envilder is the tool you need if you:
|
|
84
86
|
|
|
85
|
-
- ๐ฅ **Work in a
|
|
86
|
-
- ๐ **Deal with API
|
|
87
|
-
- โ๏ธ **Run CI/CD
|
|
88
|
-
- โ๏ธ **Use AWS
|
|
89
|
-
- ๐ **Manage
|
|
87
|
+
- ๐ฅ **Work in a development team** - Ensure everyone has the same environment without sharing raw secrets
|
|
88
|
+
- ๐ **Deal with API keys & tokens** - Securely store and retrieve sensitive credentials
|
|
89
|
+
- โ๏ธ **Run CI/CD pipelines** - Automatically generate environment files during deployments
|
|
90
|
+
- โ๏ธ **Use AWS already** - Leverage your existing AWS infrastructure more effectively
|
|
91
|
+
- ๐ **Manage multiple environments** - Switch easily between dev, staging, and production
|
|
90
92
|
|
|
91
|
-
## ๐ How
|
|
93
|
+
## ๐ How it works (simple!)
|
|
92
94
|
|
|
93
95
|
```mermaid
|
|
94
96
|
graph LR
|
|
@@ -98,10 +100,10 @@ graph LR
|
|
|
98
100
|
E[SSM Parameters] --> B
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
1. ๐ **Define
|
|
103
|
+
1. ๐ **Define your mapping** - Simple JSON mapping env vars to SSM paths
|
|
102
104
|
2. ๐ **Run Envilder** - One command with your mapping file
|
|
103
|
-
3. ๐ **Auto-
|
|
104
|
-
4. ๐พ **Get
|
|
105
|
+
3. ๐ **Auto-fetch from AWS** - Retrieves values using your AWS credentials
|
|
106
|
+
4. ๐พ **Get your .env file** - Ready to use in your project
|
|
105
107
|
|
|
106
108
|
## โ๏ธ Prerequisites
|
|
107
109
|
|
|
@@ -110,7 +112,7 @@ You'll need:
|
|
|
110
112
|
- โ
**AWS CLI** - Installed and configured with proper permissions to access SSM Parameter Store
|
|
111
113
|
- โ
**Node.js** - Version 14 or higher
|
|
112
114
|
|
|
113
|
-
### AWS CLI
|
|
115
|
+
### AWS CLI setup
|
|
114
116
|
|
|
115
117
|
1. Install the AWS CLI by following the [official instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
|
|
116
118
|
2. After installation, configure the AWS CLI:
|
|
@@ -149,7 +151,7 @@ envilder --map=<mapping-file> --envfile=<output-file> [--profile=<aws-profile>]
|
|
|
149
151
|
| `--envfile` | Path to output .env file (required) |
|
|
150
152
|
| `--profile` | AWS CLI profile to use (optional) |
|
|
151
153
|
|
|
152
|
-
## ๐ง Quick
|
|
154
|
+
## ๐ง Quick example
|
|
153
155
|
|
|
154
156
|
1. Create a mapping file `param-map.json`:
|
|
155
157
|
|
|
@@ -172,7 +174,7 @@ envilder --map=<mapping-file> --envfile=<output-file> [--profile=<aws-profile>]
|
|
|
172
174
|
envilder --map=param-map.json --envfile=.env --profile=dev-account
|
|
173
175
|
```
|
|
174
176
|
|
|
175
|
-
## ๐ Working with
|
|
177
|
+
## ๐ Working with multiple AWS profiles
|
|
176
178
|
|
|
177
179
|
For multiple AWS accounts or environments, configure different profiles in your AWS credentials file:
|
|
178
180
|
|
|
@@ -203,14 +205,63 @@ or `%USERPROFILE%\.aws\credentials` on Windows):
|
|
|
203
205
|
envilder --map=param-map.json --envfile=.env.production --profile=prod-account
|
|
204
206
|
```
|
|
205
207
|
|
|
206
|
-
##
|
|
208
|
+
## ๐ ๏ธ Advanced usage: environment-specific parameters
|
|
209
|
+
|
|
210
|
+
Envilder works brilliantly with environment variables for dynamic parameter paths:
|
|
211
|
+
|
|
212
|
+
1. Set up your SSM parameters with environment-specific paths:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
/project/dev/DB_PASSWORD
|
|
216
|
+
/project/stage/DB_PASSWORD
|
|
217
|
+
/project/prod/DB_PASSWORD
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
2. Create a template-based mapping file `env-map.json`:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"DB_PASSWORD": "/project/${ENV}/DB_PASSWORD"
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
3. Generate environment-specific .env files:
|
|
229
|
+
|
|
230
|
+
```powershell
|
|
231
|
+
# Development
|
|
232
|
+
$env:ENV = "dev"
|
|
233
|
+
envilder --map=env-map.json --envfile=.env.dev
|
|
234
|
+
|
|
235
|
+
# Staging
|
|
236
|
+
$env:ENV = "stage"
|
|
237
|
+
envilder --map=env-map.json --envfile=.env.stage
|
|
238
|
+
|
|
239
|
+
# Production
|
|
240
|
+
$env:ENV = "prod"
|
|
241
|
+
envilder --map=env-map.json --envfile=.env.prod --profile=prod-account
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
This approach ensures the right variables are pulled for each environment with minimal configuration.
|
|
245
|
+
|
|
246
|
+
## ๐ Sample `.env` output
|
|
207
247
|
|
|
208
248
|
```ini
|
|
209
249
|
SECRET_TOKEN=mockedEmail@example.com
|
|
210
250
|
SECRET_KEY=mockedPassword
|
|
211
251
|
```
|
|
212
252
|
|
|
213
|
-
##
|
|
253
|
+
## ๐ฏ Why use Envilder in practice?
|
|
254
|
+
|
|
255
|
+
Envilder eliminates common problems in development teams:
|
|
256
|
+
|
|
257
|
+
- **๐ No more "it works on my machine"** - Everyone uses the exact same environment variables from the same source
|
|
258
|
+
- **๐ Always fresh credentials** - Update a secret in SSM and everyone gets it automatically on next run
|
|
259
|
+
- **๐ก๏ธ Access control built-in** - Developers only see dev secrets, CI/CD systems see what they need
|
|
260
|
+
- **๐ง Zero mental overhead** - No need to remember which variables are needed - the mapping defines everything
|
|
261
|
+
- **๐ซ No more sharing secrets** - Stop pasting credentials in Slack, email, or Notion documents
|
|
262
|
+
- **๐ Compliance ready** - All accesses are logged in AWS CloudTrail for auditing
|
|
263
|
+
|
|
264
|
+
## ๐งช Running tests
|
|
214
265
|
|
|
215
266
|
```bash
|
|
216
267
|
yarn test
|
package/lib/cli/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "envilder",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "A CLI
|
|
3
|
+
"version": "0.5.2",
|
|
4
|
+
"description": "A CLI that securely centralizes your environment variables from AWS SSM as a single source of truth",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"import": "./lib/index.js",
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
"envilder": "lib/cli/cli.js"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"clean": "npx jest --clearCache && yarn cache clean --force && npx rimraf lib && npx rimraf node_modules && npx rimraf coverage
|
|
16
|
+
"clean": "npx jest --clearCache && yarn cache clean --force && npx rimraf lib && npx rimraf node_modules && npx rimraf coverage",
|
|
17
17
|
"test-run": "yarn build && node lib/cli/cli.js --map=tests/sample/param-map.json --envfile=tests/sample/autogenerated.env",
|
|
18
|
-
"build": "tsc -p tsconfig.build.json --sourceMap --declaration
|
|
18
|
+
"build": "tsc -p tsconfig.build.json --sourceMap --declaration",
|
|
19
|
+
"local-deploy": "yarn build && node --no-warnings scripts/pack-and-install.js",
|
|
19
20
|
"validate-cli": "node --no-warnings --loader ts-node/esm scripts/validate-cli.ts",
|
|
20
21
|
"format": "npx biome format",
|
|
21
22
|
"format:write": "npx biome format --write",
|
|
@@ -28,7 +29,23 @@
|
|
|
28
29
|
"npm-release-minor": "yarn version --new-version minor",
|
|
29
30
|
"npm-release-prerelease": "yarn version --new-version prerelease"
|
|
30
31
|
},
|
|
31
|
-
"keywords": [
|
|
32
|
+
"keywords": [
|
|
33
|
+
"env",
|
|
34
|
+
"dotenv",
|
|
35
|
+
"aws",
|
|
36
|
+
"ssm",
|
|
37
|
+
"parameter-store",
|
|
38
|
+
"cli",
|
|
39
|
+
"environment",
|
|
40
|
+
"secrets",
|
|
41
|
+
"automation",
|
|
42
|
+
"config",
|
|
43
|
+
"aws-cli",
|
|
44
|
+
"devops",
|
|
45
|
+
"ci-cd",
|
|
46
|
+
"secure",
|
|
47
|
+
"envfile"
|
|
48
|
+
],
|
|
32
49
|
"repository": {
|
|
33
50
|
"type": "git",
|
|
34
51
|
"url": "git://github.com/macalbert/envilder.git"
|