envilder 0.3.1 โ 0.3.3
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/.github/workflows/publish.yml +19 -17
- package/README.md +137 -54
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: ๐ Power-Up Publisher
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -9,37 +9,37 @@ on:
|
|
|
9
9
|
- 'package.json'
|
|
10
10
|
- '.github/workflows/publish.yml'
|
|
11
11
|
|
|
12
|
+
# Add explicit permissions for the GITHUB_TOKEN
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
packages: write
|
|
16
|
+
|
|
12
17
|
jobs:
|
|
13
18
|
publish:
|
|
14
19
|
runs-on: ubuntu-latest
|
|
15
20
|
steps:
|
|
16
|
-
- name: Checkout repository
|
|
21
|
+
- name: ๐งฑ Checkout repository
|
|
17
22
|
uses: actions/checkout@v3
|
|
18
23
|
with:
|
|
19
24
|
fetch-depth: 0
|
|
20
25
|
|
|
21
|
-
- name: Setup Node.js
|
|
26
|
+
- name: ๐ง Setup Node.js
|
|
22
27
|
uses: actions/setup-node@v3
|
|
23
28
|
with:
|
|
24
29
|
node-version: '20'
|
|
25
30
|
registry-url: 'https://registry.npmjs.org'
|
|
26
31
|
cache: 'yarn'
|
|
27
32
|
|
|
28
|
-
- name: Install dependencies
|
|
33
|
+
- name: ๐ Install dependencies
|
|
29
34
|
run: yarn install --frozen-lockfile
|
|
30
35
|
|
|
31
|
-
- name: Lint
|
|
32
|
-
run: yarn lint
|
|
33
|
-
|
|
34
|
-
- name: Security Check
|
|
35
|
-
run: |
|
|
36
|
-
npm install -g @secretlint/secretlint-rule-preset-recommend secretlint
|
|
37
|
-
secretlint "**/*" --secretlintrc .secretlintrc.json
|
|
36
|
+
- name: ๐ฅ Lint
|
|
37
|
+
run: yarn lint
|
|
38
38
|
|
|
39
|
-
- name: Run tests
|
|
39
|
+
- name: ๐ Run tests
|
|
40
40
|
run: yarn test
|
|
41
41
|
|
|
42
|
-
- name: Detect version bump
|
|
42
|
+
- name: ๐ Detect version bump
|
|
43
43
|
id: version-check
|
|
44
44
|
run: |
|
|
45
45
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
@@ -58,21 +58,23 @@ jobs:
|
|
|
58
58
|
echo "version_changed=false" >> $GITHUB_OUTPUT
|
|
59
59
|
fi
|
|
60
60
|
|
|
61
|
-
- name: Build package
|
|
61
|
+
- name: ๐จ Build package
|
|
62
62
|
if: steps.version-check.outputs.version_changed == 'true'
|
|
63
63
|
run: yarn build
|
|
64
64
|
|
|
65
|
-
- name: Publish to npm
|
|
65
|
+
- name: ๐ฉ Publish to npm
|
|
66
66
|
if: steps.version-check.outputs.version_changed == 'true'
|
|
67
67
|
run: yarn publish --non-interactive
|
|
68
68
|
env:
|
|
69
69
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
70
70
|
|
|
71
|
-
- name: Create GitHub Release
|
|
71
|
+
- name: ๐ฐ Create GitHub Release
|
|
72
72
|
if: steps.version-check.outputs.version_changed == 'true'
|
|
73
73
|
uses: ncipollo/release-action@v1
|
|
74
74
|
with:
|
|
75
75
|
tag: "v${{ steps.version-check.outputs.current_version }}"
|
|
76
|
-
name: "Release v${{ steps.version-check.outputs.current_version }}"
|
|
76
|
+
name: "๐ Level Up Release v${{ steps.version-check.outputs.current_version }}"
|
|
77
77
|
generateReleaseNotes: true
|
|
78
78
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
79
|
+
makeLatest: legacy
|
|
80
|
+
replacesArtifacts: true
|
package/README.md
CHANGED
|
@@ -1,26 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<br>
|
|
3
|
+
<img src="https://github.com/user-attachments/assets/96bf1efa-7d21-440a-a414-3a20e7f9a1f1" alt="Envilder" width="200">
|
|
4
|
+
<br>
|
|
5
|
+
Envilder
|
|
6
|
+
<br>
|
|
7
|
+
</h1>
|
|
8
|
+
|
|
9
|
+
<h4 align="center">Secure Your Environment Variables with AWS SSM Parameter Store</h4>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/envilder">
|
|
13
|
+
<img src="https://img.shields.io/npm/v/envilder.svg" alt="npm version">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="./LICENSE">
|
|
16
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://macalbert.github.io/envilder/">
|
|
19
|
+
<img src="https://img.shields.io/badge/coverage-report-green.svg" alt="Coverage Report">
|
|
20
|
+
</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<b>Stop committing secrets to your repo! Start using AWS SSM Parameter Store to secure your credentials.</b>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
## โก Quick Start
|
|
2
28
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
29
|
+
```bash
|
|
30
|
+
# Install globally
|
|
31
|
+
npm install -g envilder
|
|
32
|
+
|
|
33
|
+
# Create a simple mapping file
|
|
34
|
+
echo '{"DB_PASSWORD": "/my-app/db/password"}' > param-map.json
|
|
35
|
+
|
|
36
|
+
# Generate your .env file
|
|
37
|
+
envilder --map=param-map.json --envfile=.env
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## ๐ค What Problem Does Envilder Solve?
|
|
41
|
+
|
|
42
|
+
<table>
|
|
43
|
+
<tr>
|
|
44
|
+
<th>โ Without Envilder</th>
|
|
45
|
+
<th>โ
With Envilder</th>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td>
|
|
49
|
+
|
|
50
|
+
```plaintext
|
|
51
|
+
- Secrets committed to repos
|
|
52
|
+
- Manual .env file updates
|
|
53
|
+
- Inconsistent environments
|
|
54
|
+
- Password sharing via chat/email
|
|
55
|
+
- CI/CD secrets management pain
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
</td>
|
|
59
|
+
<td>
|
|
60
|
+
|
|
61
|
+
```plaintext
|
|
62
|
+
- Secrets stored securely in AWS SSM
|
|
63
|
+
- Automated .env file generation
|
|
64
|
+
- Consistent environments
|
|
65
|
+
- No need to share raw credentials
|
|
66
|
+
- Simple CI/CD integration
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
|
|
73
|
+
## ๐ก Why Envilder?
|
|
74
|
+
|
|
75
|
+
- ๐ **No More Secrets in Git** - Store credentials in AWS SSM Parameter Store instead of version control
|
|
76
|
+
- ๐ค **Automate Everything** - One command to generate your `.env` files across all environments
|
|
77
|
+
- ๐ **Always in Sync** - Keep your local, dev, and production environments consistent
|
|
78
|
+
- ๐๏ธ **Fast to Set Up** - Configure once, then generate `.env` files with a single command
|
|
79
|
+
- ๐ชถ **Simple but Powerful** - Easy interface with support for encrypted parameters and multiple AWS profiles
|
|
80
|
+
|
|
81
|
+
## ๐ฏ Perfect for Teams
|
|
82
|
+
|
|
83
|
+
Envilder is the tool you need if you:
|
|
6
84
|
|
|
7
|
-
|
|
85
|
+
- ๐ฅ **Work in a Development Team** - Ensure everyone has the same environment without sharing raw secrets
|
|
86
|
+
- ๐ **Deal with API Keys & Tokens** - Securely store and retrieve sensitive credentials
|
|
87
|
+
- โ๏ธ **Run CI/CD Pipelines** - Automatically generate environment files during deployments
|
|
88
|
+
- โ๏ธ **Use AWS Already** - Leverage your existing AWS infrastructure more effectively
|
|
89
|
+
- ๐ **Manage Multiple Environments** - Switch easily between dev, staging, and production
|
|
8
90
|
|
|
9
|
-
|
|
10
|
-
- โก Automatically generates a `.env` file with specified parameters.
|
|
11
|
-
- ๐ก๏ธ Handles encrypted SSM parameters.
|
|
12
|
-
- ๐ชถ Lightweight and simple to use.
|
|
13
|
-
- ๐ Support for multiple AWS profiles.
|
|
91
|
+
## ๐ How It Works (Simple!)
|
|
14
92
|
|
|
15
|
-
|
|
93
|
+
```mermaid
|
|
94
|
+
graph LR
|
|
95
|
+
A[Mapping File] --> B[Envilder]
|
|
96
|
+
C[AWS Credentials] --> B
|
|
97
|
+
B --> D[.env File]
|
|
98
|
+
E[SSM Parameters] --> B
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
1. ๐ **Define Your Mapping** - Simple JSON mapping env vars to SSM paths
|
|
102
|
+
2. ๐ **Run Envilder** - One command with your mapping file
|
|
103
|
+
3. ๐ **Auto-Fetch from AWS** - Retrieves values using your AWS credentials
|
|
104
|
+
4. ๐พ **Get Your .env File** - Ready to use in your project
|
|
105
|
+
|
|
106
|
+
## โ๏ธ Prerequisites
|
|
107
|
+
|
|
108
|
+
You'll need:
|
|
16
109
|
|
|
17
|
-
|
|
18
|
-
|
|
110
|
+
- โ
**AWS CLI** - Installed and configured with proper permissions to access SSM Parameter Store
|
|
111
|
+
- โ
**Node.js** - Version 14 or higher
|
|
19
112
|
|
|
20
|
-
|
|
113
|
+
### AWS CLI Setup
|
|
21
114
|
|
|
22
|
-
1. Install the AWS CLI by following the instructions
|
|
23
|
-
2. After installation, configure the AWS CLI
|
|
115
|
+
1. Install the AWS CLI by following the [official instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
|
|
116
|
+
2. After installation, configure the AWS CLI:
|
|
24
117
|
|
|
25
118
|
```bash
|
|
26
119
|
aws configure
|
|
@@ -32,38 +125,31 @@ machine. This configuration is required for `Envilder` to access and manage para
|
|
|
32
125
|
- Default region name (e.g., `us-east-1`)
|
|
33
126
|
- Default output format (e.g., `json`)
|
|
34
127
|
|
|
35
|
-
Make sure
|
|
36
|
-
Store in your AWS account.
|
|
128
|
+
Make sure your AWS credentials have the appropriate permissions to access the SSM Parameter Store.
|
|
37
129
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
You can install `Envilder` globally using yarn. This will allow you to use the `envilder` command from any
|
|
41
|
-
directory on your system.
|
|
130
|
+
## ๐ฆ Installation
|
|
42
131
|
|
|
43
132
|
```bash
|
|
133
|
+
# Using npm
|
|
134
|
+
npm install -g envilder
|
|
135
|
+
|
|
136
|
+
# Using yarn
|
|
44
137
|
yarn global add envilder
|
|
45
138
|
```
|
|
46
139
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
You can install **envilder** globally or locally using npm:
|
|
140
|
+
## ๐ Usage
|
|
50
141
|
|
|
51
142
|
```bash
|
|
52
|
-
|
|
143
|
+
envilder --map=<mapping-file> --envfile=<output-file> [--profile=<aws-profile>]
|
|
53
144
|
```
|
|
54
145
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- `--envfile <path>`: Path where the generated .env file will be saved.
|
|
61
|
-
|
|
62
|
-
Optional arguments:
|
|
146
|
+
| Option | Description |
|
|
147
|
+
|--------|-------------|
|
|
148
|
+
| `--map` | Path to JSON mapping file (required) |
|
|
149
|
+
| `--envfile` | Path to output .env file (required) |
|
|
150
|
+
| `--profile` | AWS CLI profile to use (optional) |
|
|
63
151
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
# ๐ง Example
|
|
152
|
+
## ๐ง Quick Example
|
|
67
153
|
|
|
68
154
|
1. Create a mapping file `param-map.json`:
|
|
69
155
|
|
|
@@ -74,25 +160,24 @@ Optional arguments:
|
|
|
74
160
|
}
|
|
75
161
|
```
|
|
76
162
|
|
|
77
|
-
2.
|
|
163
|
+
2. Generate your `.env` file:
|
|
78
164
|
|
|
79
165
|
```bash
|
|
80
166
|
envilder --map=param-map.json --envfile=.env
|
|
81
167
|
```
|
|
82
168
|
|
|
83
|
-
3.
|
|
169
|
+
3. Use a specific AWS profile:
|
|
84
170
|
|
|
85
171
|
```bash
|
|
86
172
|
envilder --map=param-map.json --envfile=.env --profile=dev-account
|
|
87
173
|
```
|
|
88
174
|
|
|
89
|
-
4. The `.env` file will be generated in the specified location.
|
|
90
|
-
|
|
91
175
|
## ๐ Working with Multiple AWS Profiles
|
|
92
176
|
|
|
93
|
-
|
|
177
|
+
For multiple AWS accounts or environments, configure different profiles in your AWS credentials file:
|
|
94
178
|
|
|
95
|
-
1. Edit your AWS credentials file (
|
|
179
|
+
1. Edit your AWS credentials file (typically located at `~/.aws/credentials` on Linux/Mac
|
|
180
|
+
or `%USERPROFILE%\.aws\credentials` on Windows):
|
|
96
181
|
|
|
97
182
|
```ini
|
|
98
183
|
[default]
|
|
@@ -108,37 +193,35 @@ If you work with multiple AWS accounts or environments, you can configure differ
|
|
|
108
193
|
aws_secret_access_key=YOUR_PROD_SECRET_KEY
|
|
109
194
|
```
|
|
110
195
|
|
|
111
|
-
2.
|
|
196
|
+
2. Specify which profile to use:
|
|
112
197
|
|
|
113
198
|
```bash
|
|
114
|
-
#
|
|
199
|
+
# Development environment
|
|
115
200
|
envilder --map=param-map.json --envfile=.env.development --profile=dev-account
|
|
116
201
|
|
|
117
|
-
#
|
|
202
|
+
# Production environment
|
|
118
203
|
envilder --map=param-map.json --envfile=.env.production --profile=prod-account
|
|
119
204
|
```
|
|
120
205
|
|
|
121
|
-
|
|
206
|
+
## ๐ Sample `.env` Output
|
|
122
207
|
|
|
123
|
-
```
|
|
208
|
+
```ini
|
|
124
209
|
SECRET_TOKEN=mockedEmail@example.com
|
|
125
210
|
SECRET_KEY=mockedPassword
|
|
126
211
|
```
|
|
127
212
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
To run the tests with coverage:
|
|
213
|
+
## ๐งช Running Tests
|
|
131
214
|
|
|
132
215
|
```bash
|
|
133
216
|
yarn test
|
|
134
217
|
```
|
|
135
218
|
|
|
136
|
-
|
|
219
|
+
Check the current coverage report: [Coverage Report](https://macalbert.github.io/envilder/)
|
|
137
220
|
|
|
138
|
-
|
|
221
|
+
## ๐ License
|
|
139
222
|
|
|
140
223
|
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
141
224
|
|
|
142
|
-
|
|
225
|
+
## ๐ Contributing
|
|
143
226
|
|
|
144
227
|
Contributions are welcome! Feel free to submit issues and pull requests.
|
package/package.json
CHANGED