envmatic 1.0.0
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 +567 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +203 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +11 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +77 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/delete.d.ts +6 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +78 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/edit.d.ts +13 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +364 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/import.d.ts +11 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +103 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +237 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/link.d.ts +16 -0
- package/dist/commands/link.d.ts.map +1 -0
- package/dist/commands/link.js +157 -0
- package/dist/commands/link.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +73 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/lock.d.ts +16 -0
- package/dist/commands/lock.d.ts.map +1 -0
- package/dist/commands/lock.js +245 -0
- package/dist/commands/lock.js.map +1 -0
- package/dist/commands/rotate.d.ts +15 -0
- package/dist/commands/rotate.d.ts.map +1 -0
- package/dist/commands/rotate.js +406 -0
- package/dist/commands/rotate.js.map +1 -0
- package/dist/commands/show.d.ts +9 -0
- package/dist/commands/show.d.ts.map +1 -0
- package/dist/commands/show.js +72 -0
- package/dist/commands/show.js.map +1 -0
- package/dist/commands/sync.d.ts +13 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +174 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/use.d.ts +19 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +238 -0
- package/dist/commands/use.js.map +1 -0
- package/dist/constants.d.ts +20 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +47 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/services/config.d.ts +64 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +133 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/encryption.d.ts +30 -0
- package/dist/services/encryption.d.ts.map +1 -0
- package/dist/services/encryption.js +146 -0
- package/dist/services/encryption.js.map +1 -0
- package/dist/services/envfile.d.ts +76 -0
- package/dist/services/envfile.d.ts.map +1 -0
- package/dist/services/envfile.js +247 -0
- package/dist/services/envfile.js.map +1 -0
- package/dist/services/git.d.ts +60 -0
- package/dist/services/git.d.ts.map +1 -0
- package/dist/services/git.js +239 -0
- package/dist/services/git.js.map +1 -0
- package/dist/services/linker.d.ts +46 -0
- package/dist/services/linker.d.ts.map +1 -0
- package/dist/services/linker.js +222 -0
- package/dist/services/linker.js.map +1 -0
- package/dist/services/protection.d.ts +32 -0
- package/dist/services/protection.d.ts.map +1 -0
- package/dist/services/protection.js +190 -0
- package/dist/services/protection.js.map +1 -0
- package/dist/types/index.d.ts +73 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/display.d.ts +74 -0
- package/dist/utils/display.d.ts.map +1 -0
- package/dist/utils/display.js +138 -0
- package/dist/utils/display.js.map +1 -0
- package/dist/utils/editor.d.ts +22 -0
- package/dist/utils/editor.d.ts.map +1 -0
- package/dist/utils/editor.js +159 -0
- package/dist/utils/editor.js.map +1 -0
- package/dist/utils/prompts.d.ts +41 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.js +222 -0
- package/dist/utils/prompts.js.map +1 -0
- package/package.json +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
# ◆ Envmatic
|
|
2
|
+
|
|
3
|
+
**Your secrets, your control.**
|
|
4
|
+
|
|
5
|
+
Envmatic is a cross-platform CLI tool for managing dotfiles and environment secrets. It uses Git as a secure, private storage backend with optional AES-256 encryption.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🔐 **AES-256 Encryption** - Protect secrets with password or SSH key
|
|
10
|
+
- 🌐 **Git-Based Storage** - Use any private Git repository
|
|
11
|
+
- 📁 **Organized Structure** - Intuitive project/environment hierarchy
|
|
12
|
+
- 🔗 **Smart Linking** - Symlink or copy secrets to projects
|
|
13
|
+
- 🔒 **Immutable Files** - Protect against accidental changes
|
|
14
|
+
- ✏️ **External Editor Support** - Edit with Vim, Neovim, VS Code, etc.
|
|
15
|
+
- 🔄 **Password Rotation** - Change encryption password or switch methods
|
|
16
|
+
- 🖥️ **Cross-Platform** - Works on Windows, macOS, and Linux
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g envmatic
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or use with npx:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx envmatic init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### 1. Initialize with your private repo
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
envmatic init
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You'll be prompted for:
|
|
39
|
+
- Your private Git repository URL
|
|
40
|
+
- Encryption preference (password or SSH key)
|
|
41
|
+
- File protection settings
|
|
42
|
+
|
|
43
|
+
### 2. Add your first env file
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
envmatic add
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or import an existing file:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
envmatic import .env --project myapp --environment development
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Use in your project
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Quick: Auto-detect project and pull matching env
|
|
59
|
+
cd myapp
|
|
60
|
+
envmatic pull
|
|
61
|
+
|
|
62
|
+
# Or specify environment
|
|
63
|
+
envmatic pull --env production
|
|
64
|
+
|
|
65
|
+
# Or browse and select manually
|
|
66
|
+
envmatic use
|
|
67
|
+
|
|
68
|
+
# Or use a specific file ID
|
|
69
|
+
envmatic use "myapp/development/.env"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Commands Reference
|
|
75
|
+
|
|
76
|
+
### Setup & Configuration
|
|
77
|
+
|
|
78
|
+
#### `envmatic init`
|
|
79
|
+
|
|
80
|
+
Initialize Envmatic with a Git repository.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
envmatic init [options]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
| Option | Description |
|
|
87
|
+
|--------|-------------|
|
|
88
|
+
| `-f, --force` | Force re-initialization (overwrites current settings) |
|
|
89
|
+
|
|
90
|
+
#### `envmatic status`
|
|
91
|
+
|
|
92
|
+
Show current status and configuration.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
envmatic status [options]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| Option | Description |
|
|
99
|
+
|--------|-------------|
|
|
100
|
+
| `--json` | Output as JSON |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### Security & Encryption
|
|
105
|
+
|
|
106
|
+
#### `envmatic change-password`
|
|
107
|
+
|
|
108
|
+
Change your encryption password. Requires the current password to decrypt and re-encrypt all files.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
envmatic change-password
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> ⚠️ **Warning:** If you forget your password, all encrypted data will be permanently lost.
|
|
115
|
+
|
|
116
|
+
#### `envmatic rotate-key`
|
|
117
|
+
|
|
118
|
+
Rotate encryption key or change encryption method (password ↔ SSH key).
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
envmatic rotate-key
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Allows you to:
|
|
125
|
+
- Switch from password to SSH key encryption
|
|
126
|
+
- Switch from SSH key to password encryption
|
|
127
|
+
- Disable encryption (not recommended)
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### File Management
|
|
132
|
+
|
|
133
|
+
#### `envmatic add`
|
|
134
|
+
|
|
135
|
+
Add a new env file to the vault interactively.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
envmatic add [options]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
| Option | Description |
|
|
142
|
+
|--------|-------------|
|
|
143
|
+
| `-p, --project <name>` | Project name |
|
|
144
|
+
| `-e, --environment <name>` | Environment name |
|
|
145
|
+
| `-n, --name <name>` | File name (default: `.env`) |
|
|
146
|
+
| `-d, --description <text>` | Description |
|
|
147
|
+
|
|
148
|
+
#### `envmatic import`
|
|
149
|
+
|
|
150
|
+
Import an existing `.env` file into the vault.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
envmatic import <path> [options]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| Option | Description |
|
|
157
|
+
|--------|-------------|
|
|
158
|
+
| `-p, --project <name>` | Project name |
|
|
159
|
+
| `-e, --environment <name>` | Environment name |
|
|
160
|
+
| `-n, --name <name>` | File name |
|
|
161
|
+
| `-d, --description <text>` | Description |
|
|
162
|
+
|
|
163
|
+
**Example:**
|
|
164
|
+
```bash
|
|
165
|
+
envmatic import .env --project myapp --environment development
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### `envmatic list`
|
|
169
|
+
|
|
170
|
+
List all env files in the vault.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
envmatic list [options]
|
|
174
|
+
# Alias: envmatic ls
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
| Option | Description |
|
|
178
|
+
|--------|-------------|
|
|
179
|
+
| `-p, --project <name>` | Filter by project |
|
|
180
|
+
| `--json` | Output as JSON |
|
|
181
|
+
|
|
182
|
+
#### `envmatic show`
|
|
183
|
+
|
|
184
|
+
Display contents of an env file.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
envmatic show [file-id] [options]
|
|
188
|
+
# Alias: envmatic get
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
| Option | Description |
|
|
192
|
+
|--------|-------------|
|
|
193
|
+
| `-r, --reveal` | Reveal full values (not masked) |
|
|
194
|
+
| `--json` | Output as JSON |
|
|
195
|
+
|
|
196
|
+
**Example:**
|
|
197
|
+
```bash
|
|
198
|
+
envmatic show myapp/development/.env --reveal
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### `envmatic edit`
|
|
202
|
+
|
|
203
|
+
Edit an env file interactively or with an external editor.
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
envmatic edit [file-id] [options]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| Option | Description |
|
|
210
|
+
|--------|-------------|
|
|
211
|
+
| `-e, --editor` | Open in external editor (Vim, Neovim, VS Code, etc.) |
|
|
212
|
+
|
|
213
|
+
**Interactive mode (default):**
|
|
214
|
+
```bash
|
|
215
|
+
envmatic edit myapp/development/.env
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**External editor mode:**
|
|
219
|
+
```bash
|
|
220
|
+
envmatic edit myapp/development/.env --editor
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
When using `--editor`, you'll be prompted to choose from available editors on your system.
|
|
224
|
+
|
|
225
|
+
#### `envmatic set`
|
|
226
|
+
|
|
227
|
+
Set a single variable in an env file.
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
envmatic set <file-id> <key> <value>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Example:**
|
|
234
|
+
```bash
|
|
235
|
+
envmatic set myapp/production/.env API_KEY sk-1234567890
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### `envmatic unset`
|
|
239
|
+
|
|
240
|
+
Remove a variable from an env file.
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
envmatic unset <file-id> <key>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Example:**
|
|
247
|
+
```bash
|
|
248
|
+
envmatic unset myapp/production/.env OLD_API_KEY
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### `envmatic delete`
|
|
252
|
+
|
|
253
|
+
Delete an env file from the vault.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
envmatic delete [file-id]
|
|
257
|
+
# Alias: envmatic rm
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### `envmatic lock`
|
|
261
|
+
|
|
262
|
+
Lock (protect) env files after editing. Lists all unlocked files and allows you to secure them.
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
envmatic lock [file-id] [options]
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
| Option | Description |
|
|
269
|
+
|--------|-------------|
|
|
270
|
+
| `-a, --all` | Lock all unlocked files |
|
|
271
|
+
|
|
272
|
+
**Examples:**
|
|
273
|
+
```bash
|
|
274
|
+
# List and lock unlocked files interactively
|
|
275
|
+
envmatic lock
|
|
276
|
+
|
|
277
|
+
# Lock a specific file
|
|
278
|
+
envmatic lock myapp/development/.env
|
|
279
|
+
|
|
280
|
+
# Lock all unlocked files
|
|
281
|
+
envmatic lock --all
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
### Project Integration
|
|
287
|
+
|
|
288
|
+
#### `envmatic use`
|
|
289
|
+
|
|
290
|
+
Import an env file into the current project.
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
envmatic use [file-id] [options]
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
| Option | Description |
|
|
297
|
+
|--------|-------------|
|
|
298
|
+
| `-o, --output <path>` | Output file path (default: `.env`) |
|
|
299
|
+
| `-s, --symlink` | Create symlink instead of copy |
|
|
300
|
+
| `-f, --force` | Overwrite without confirmation |
|
|
301
|
+
|
|
302
|
+
**Example:**
|
|
303
|
+
```bash
|
|
304
|
+
envmatic use myapp/production/.env --output .env.production
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
#### `envmatic pull`
|
|
308
|
+
|
|
309
|
+
Auto-detect project and pull matching env file.
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
envmatic pull [options]
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
| Option | Description |
|
|
316
|
+
|--------|-------------|
|
|
317
|
+
| `-e, --env <name>` | Environment name (development, production, etc.) |
|
|
318
|
+
| `-o, --output <path>` | Output file path (default: `.env`) |
|
|
319
|
+
| `-s, --symlink` | Create symlink instead of copy |
|
|
320
|
+
| `-f, --force` | Overwrite without confirmation |
|
|
321
|
+
|
|
322
|
+
**Example:**
|
|
323
|
+
```bash
|
|
324
|
+
cd myapp
|
|
325
|
+
envmatic pull --env production --output .env
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### `envmatic link`
|
|
329
|
+
|
|
330
|
+
Create a symlink to an env file.
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
envmatic link [file-id] [target] [options]
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
| Option | Description |
|
|
337
|
+
|--------|-------------|
|
|
338
|
+
| `-c, --copy` | Create a copy instead of symlink |
|
|
339
|
+
| `-a, --auto-sync` | Auto-sync copies on changes |
|
|
340
|
+
|
|
341
|
+
> **Note:** Symlinks only work for unencrypted files. Encrypted files require copy mode.
|
|
342
|
+
|
|
343
|
+
**Example:**
|
|
344
|
+
```bash
|
|
345
|
+
envmatic link myapp/development/.env ./.env
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### `envmatic copy`
|
|
349
|
+
|
|
350
|
+
Create a decrypted copy of an env file.
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
envmatic copy [file-id] [target] [options]
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
| Option | Description |
|
|
357
|
+
|--------|-------------|
|
|
358
|
+
| `-a, --auto-sync` | Auto-sync on changes |
|
|
359
|
+
|
|
360
|
+
**Example:**
|
|
361
|
+
```bash
|
|
362
|
+
envmatic copy myapp/production/.env ./.env
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### `envmatic unlink`
|
|
366
|
+
|
|
367
|
+
Remove a linked file.
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
envmatic unlink [target]
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
#### `envmatic links`
|
|
374
|
+
|
|
375
|
+
List all linked files.
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
envmatic links [options]
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
| Option | Description |
|
|
382
|
+
|--------|-------------|
|
|
383
|
+
| `--json` | Output as JSON |
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
### Sync
|
|
388
|
+
|
|
389
|
+
#### `envmatic sync`
|
|
390
|
+
|
|
391
|
+
Sync vault with remote repository.
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
envmatic sync [options]
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
| Option | Description |
|
|
398
|
+
|--------|-------------|
|
|
399
|
+
| `--push` | Push only |
|
|
400
|
+
| `--pull` | Pull only |
|
|
401
|
+
|
|
402
|
+
#### `envmatic sync-links`
|
|
403
|
+
|
|
404
|
+
Update all copied files from vault.
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
envmatic sync-links
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Vault Structure
|
|
413
|
+
|
|
414
|
+
Your secrets are organized in an intuitive hierarchy:
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
~/.envmatic/vault/
|
|
418
|
+
├── myapp/
|
|
419
|
+
│ ├── development/
|
|
420
|
+
│ │ └── .env.enc
|
|
421
|
+
│ ├── staging/
|
|
422
|
+
│ │ └── .env.enc
|
|
423
|
+
│ └── production/
|
|
424
|
+
│ └── .env.enc
|
|
425
|
+
├── another-project/
|
|
426
|
+
│ └── local/
|
|
427
|
+
│ └── .env.enc
|
|
428
|
+
└── shared/
|
|
429
|
+
└── common/
|
|
430
|
+
└── .env.enc
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Encryption
|
|
436
|
+
|
|
437
|
+
Envmatic uses **AES-256-GCM** encryption with PBKDF2 key derivation (100,000 iterations, SHA-512).
|
|
438
|
+
|
|
439
|
+
### Password Mode
|
|
440
|
+
|
|
441
|
+
You'll be prompted for your password when accessing encrypted files.
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
⚠️ PASSWORD SECURITY WARNING
|
|
445
|
+
|
|
446
|
+
Your password is the ONLY way to decrypt your secrets.
|
|
447
|
+
There is NO password recovery mechanism.
|
|
448
|
+
|
|
449
|
+
If you forget your password:
|
|
450
|
+
→ All encrypted data will be PERMANENTLY LOST
|
|
451
|
+
→ There is NO way to recover your secrets
|
|
452
|
+
|
|
453
|
+
We strongly recommend:
|
|
454
|
+
• Using a password manager to store your password
|
|
455
|
+
• Writing it down and storing it securely offline
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### SSH Key Mode
|
|
459
|
+
|
|
460
|
+
Uses your existing SSH private key for encryption. No password prompt needed if your key is loaded in ssh-agent.
|
|
461
|
+
|
|
462
|
+
### Changing Password or Encryption Method
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
# Change password (requires current password)
|
|
466
|
+
envmatic change-password
|
|
467
|
+
|
|
468
|
+
# Switch encryption method (password ↔ SSH key)
|
|
469
|
+
envmatic rotate-key
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Programmatic Usage
|
|
475
|
+
|
|
476
|
+
Envmatic can be imported into your Node.js projects:
|
|
477
|
+
|
|
478
|
+
```typescript
|
|
479
|
+
import {
|
|
480
|
+
readEnvFile,
|
|
481
|
+
listEnvFiles,
|
|
482
|
+
getVariable,
|
|
483
|
+
} from 'envmatic';
|
|
484
|
+
|
|
485
|
+
// List all files
|
|
486
|
+
const files = await listEnvFiles();
|
|
487
|
+
|
|
488
|
+
// Read a file (with encryption options if needed)
|
|
489
|
+
const { variables } = await readEnvFile('myapp/development/.env', {
|
|
490
|
+
method: 'password',
|
|
491
|
+
password: process.env.ENVMATIC_PASSWORD,
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
// Get a single variable
|
|
495
|
+
const apiKey = await getVariable('myapp/production/.env', 'API_KEY', {
|
|
496
|
+
method: 'ssh',
|
|
497
|
+
sshKeyPath: '~/.ssh/id_rsa',
|
|
498
|
+
});
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
## Security Considerations
|
|
504
|
+
|
|
505
|
+
1. **Private Repository**: Always use a private Git repository
|
|
506
|
+
2. **Access Control**: Use Git's access controls to limit who can access secrets
|
|
507
|
+
3. **Encryption**: Enable encryption for sensitive production secrets
|
|
508
|
+
4. **SSH Keys**: Consider using SSH key encryption for convenience with security
|
|
509
|
+
5. **File Permissions**: Enable immutable mode to prevent accidental changes
|
|
510
|
+
6. **Password Storage**: Use a password manager; there's no recovery mechanism
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Configuration
|
|
515
|
+
|
|
516
|
+
Configuration is stored in `~/.envmatic/config.json`:
|
|
517
|
+
|
|
518
|
+
```json
|
|
519
|
+
{
|
|
520
|
+
"repoUrl": "git@github.com:you/secrets.git",
|
|
521
|
+
"encryptionEnabled": true,
|
|
522
|
+
"encryptionMethod": "password",
|
|
523
|
+
"immutableByDefault": true,
|
|
524
|
+
"branch": "main"
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## Troubleshooting
|
|
531
|
+
|
|
532
|
+
### Symlinks on Windows
|
|
533
|
+
|
|
534
|
+
Creating symlinks on Windows requires either:
|
|
535
|
+
- **Developer Mode** enabled (Settings → Update & Security → For developers)
|
|
536
|
+
- Running as Administrator
|
|
537
|
+
|
|
538
|
+
Alternatively, use the `--copy` flag or `envmatic copy` command.
|
|
539
|
+
|
|
540
|
+
### Git Authentication
|
|
541
|
+
|
|
542
|
+
Envmatic uses your system's Git configuration. Make sure you can:
|
|
543
|
+
```bash
|
|
544
|
+
git clone <your-repo-url>
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### Encryption Issues
|
|
548
|
+
|
|
549
|
+
If you're having trouble with encryption:
|
|
550
|
+
1. Verify your password is correct
|
|
551
|
+
2. For SSH, ensure your key is readable: `ssh-keygen -y -f ~/.ssh/id_rsa`
|
|
552
|
+
3. The encryption salt is stored in your vault - don't delete `.envmatic-salt`
|
|
553
|
+
|
|
554
|
+
### Unlocked Files
|
|
555
|
+
|
|
556
|
+
If you edited files with `--editor` and forgot to lock them:
|
|
557
|
+
```bash
|
|
558
|
+
envmatic lock
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
This will list all unlocked files and let you secure them.
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## License
|
|
566
|
+
|
|
567
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|