@envsafes-org/cli 0.0.10 → 0.0.11
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 +114 -114
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
# 🔐 EnvSafe CLI
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Secure environment variable manager for your teams**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@envsafes-org/cli)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
EnvSafe CLI
|
|
8
|
+
EnvSafe CLI allows you to manage your environment variables securely with end-to-end encryption. Ideal for teams wanting to centralize their secrets without compromising security.
|
|
9
9
|
|
|
10
|
-
## 🛑
|
|
10
|
+
## 🛑 Prerequisites
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Before using the CLI, you must create an account and a project on **[https://www.envsafe.dev](https://www.envsafe.dev)**.
|
|
13
13
|
|
|
14
14
|
## 📦 Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
#
|
|
17
|
+
# Global installation (recommended)
|
|
18
18
|
npm install -g @envsafes-org/cli
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# With yarn
|
|
21
21
|
yarn global add @envsafes-org/cli
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# With pnpm
|
|
24
24
|
pnpm add -g @envsafes-org/cli
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# One-time use without installation
|
|
27
27
|
npx @envsafes-org/cli
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
## 🚀
|
|
30
|
+
## 🚀 Quick Start
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
# 1.
|
|
33
|
+
# 1. Log in with your API token
|
|
34
34
|
envsafe login
|
|
35
35
|
|
|
36
|
-
# 2.
|
|
36
|
+
# 2. List your projects
|
|
37
37
|
envsafe projects
|
|
38
38
|
|
|
39
|
-
# 3.
|
|
40
|
-
envsafe pull
|
|
39
|
+
# 3. Pull your variables
|
|
40
|
+
envsafe pull my-project
|
|
41
41
|
|
|
42
|
-
# 4.
|
|
43
|
-
envsafe run
|
|
42
|
+
# 4. Or run directly with injection
|
|
43
|
+
envsafe run my-project -- npm start
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
## 📖
|
|
46
|
+
## 📖 Commands
|
|
47
47
|
|
|
48
48
|
### `envsafe login`
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Authenticate with a Personal Access Token (PAT).
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
#
|
|
53
|
+
# Interactive mode
|
|
54
54
|
envsafe login
|
|
55
55
|
|
|
56
|
-
#
|
|
56
|
+
# With direct token (CI/CD)
|
|
57
57
|
envsafe login --token es_live_xxxxxxxxxxxxx
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
**💡
|
|
60
|
+
**💡 Generate a token:** Go to your Dashboard → Settings → API Tokens
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
64
|
### `envsafe projects` (alias: `ls`)
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
List all accessible projects.
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
69
|
envsafe projects
|
|
70
|
-
#
|
|
70
|
+
# or
|
|
71
71
|
envsafe ls
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -75,73 +75,73 @@ envsafe ls
|
|
|
75
75
|
|
|
76
76
|
### `envsafe pull <project>`
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Download environment variables to a local file.
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
#
|
|
82
|
-
envsafe pull
|
|
81
|
+
# Development environment (default)
|
|
82
|
+
envsafe pull my-project
|
|
83
83
|
|
|
84
|
-
#
|
|
85
|
-
envsafe pull
|
|
86
|
-
envsafe pull
|
|
84
|
+
# Specific environment
|
|
85
|
+
envsafe pull my-project --env staging
|
|
86
|
+
envsafe pull my-project --env production
|
|
87
87
|
|
|
88
|
-
#
|
|
89
|
-
envsafe pull
|
|
90
|
-
envsafe pull
|
|
88
|
+
# Custom output file
|
|
89
|
+
envsafe pull my-project --output .env.local
|
|
90
|
+
envsafe pull my-project --env production --output .env.prod
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
**Options:**
|
|
94
|
-
- `-e, --env <environment>` :
|
|
95
|
-
- `-o, --output <file>` :
|
|
94
|
+
- `-e, --env <environment>` : Environment (development, staging, production) - Default: `development`
|
|
95
|
+
- `-o, --output <file>` : Output file - Default: `.env`
|
|
96
96
|
|
|
97
97
|
---
|
|
98
98
|
|
|
99
99
|
### `envsafe push <project>`
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Send your local variables to EnvSafe (automatically encrypted).
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
|
-
#
|
|
105
|
-
envsafe push
|
|
104
|
+
# Send .env to development
|
|
105
|
+
envsafe push my-project
|
|
106
106
|
|
|
107
|
-
#
|
|
108
|
-
envsafe push
|
|
107
|
+
# Specific environment and file
|
|
108
|
+
envsafe push my-project --env production --file .env.prod
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
**Options:**
|
|
112
|
-
- `-e, --env <environment>` :
|
|
113
|
-
- `-f, --file <file>` :
|
|
112
|
+
- `-e, --env <environment>` : Target environment - Default: `development`
|
|
113
|
+
- `-f, --file <file>` : Source file - Default: `.env`
|
|
114
114
|
|
|
115
115
|
---
|
|
116
116
|
|
|
117
117
|
### `envsafe run <project> -- <command>`
|
|
118
118
|
|
|
119
|
-
**⭐️
|
|
119
|
+
**⭐️ Recommended command**: Run a command with variables injected directly, without creating a `.env` file on disk.
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
#
|
|
123
|
-
envsafe run
|
|
124
|
-
envsafe run
|
|
122
|
+
# Development
|
|
123
|
+
envsafe run my-project -- npm start
|
|
124
|
+
envsafe run my-project -- npm run dev
|
|
125
125
|
|
|
126
126
|
# Production
|
|
127
|
-
envsafe run
|
|
127
|
+
envsafe run my-project --env production -- node server.js
|
|
128
128
|
|
|
129
|
-
#
|
|
130
|
-
envsafe run
|
|
131
|
-
envsafe run
|
|
132
|
-
envsafe run
|
|
129
|
+
# Other examples
|
|
130
|
+
envsafe run my-project -- pnpm build
|
|
131
|
+
envsafe run my-project -- python main.py
|
|
132
|
+
envsafe run my-project -- docker-compose up
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
**
|
|
136
|
-
- ✅
|
|
137
|
-
- ✅
|
|
138
|
-
- ✅
|
|
135
|
+
**Advantages:**
|
|
136
|
+
- ✅ More secure (no .env file on disk)
|
|
137
|
+
- ✅ Ideal for CI/CD
|
|
138
|
+
- ✅ No risk of accidentally committing secrets
|
|
139
139
|
|
|
140
140
|
---
|
|
141
141
|
|
|
142
142
|
### `envsafe whoami`
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
Display currently logged-in account information.
|
|
145
145
|
|
|
146
146
|
```bash
|
|
147
147
|
envsafe whoami
|
|
@@ -151,7 +151,7 @@ envsafe whoami
|
|
|
151
151
|
|
|
152
152
|
### `envsafe logout`
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
Log out (removes local token).
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
157
|
envsafe logout
|
|
@@ -161,23 +161,23 @@ envsafe logout
|
|
|
161
161
|
|
|
162
162
|
### `envsafe config`
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
Manage CLI configuration.
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
|
-
#
|
|
167
|
+
# Show current configuration
|
|
168
168
|
envsafe config --show
|
|
169
169
|
|
|
170
|
-
#
|
|
171
|
-
envsafe config --api-url https://
|
|
170
|
+
# Change API URL (for self-hosted instances)
|
|
171
|
+
envsafe config --api-url https://your-instance.com
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
---
|
|
175
175
|
|
|
176
|
-
## 🔧
|
|
176
|
+
## 🔧 CI/CD Usage
|
|
177
177
|
|
|
178
|
-
###
|
|
178
|
+
### Recommended Method: Environment Variable
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
Set `ENVSAFE_TOKEN` as a secret in your CI/CD, then use commands directly without `login`.
|
|
181
181
|
|
|
182
182
|
#### GitHub Actions
|
|
183
183
|
|
|
@@ -198,14 +198,14 @@ jobs:
|
|
|
198
198
|
env:
|
|
199
199
|
ENVSAFE_TOKEN: ${{ secrets.ENVSAFE_TOKEN }}
|
|
200
200
|
run: |
|
|
201
|
-
envsafe run
|
|
201
|
+
envsafe run my-project --env staging -- npm test
|
|
202
202
|
|
|
203
203
|
- name: Deploy to production
|
|
204
204
|
env:
|
|
205
205
|
ENVSAFE_TOKEN: ${{ secrets.ENVSAFE_TOKEN }}
|
|
206
206
|
run: |
|
|
207
|
-
envsafe run
|
|
208
|
-
envsafe run
|
|
207
|
+
envsafe run my-project --env production -- npm run build
|
|
208
|
+
envsafe run my-project --env production -- npm run deploy
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
#### GitLab CI
|
|
@@ -215,7 +215,7 @@ deploy:
|
|
|
215
215
|
stage: deploy
|
|
216
216
|
script:
|
|
217
217
|
- npm install -g @envsafes-org/cli
|
|
218
|
-
- envsafe run
|
|
218
|
+
- envsafe run my-project --env production -- npm run deploy
|
|
219
219
|
variables:
|
|
220
220
|
ENVSAFE_TOKEN: $ENVSAFE_TOKEN_SECRET
|
|
221
221
|
```
|
|
@@ -225,118 +225,118 @@ deploy:
|
|
|
225
225
|
```dockerfile
|
|
226
226
|
FROM node:20-alpine
|
|
227
227
|
|
|
228
|
-
#
|
|
228
|
+
# Install the CLI
|
|
229
229
|
RUN npm install -g @envsafes-org/cli
|
|
230
230
|
|
|
231
231
|
WORKDIR /app
|
|
232
232
|
COPY . .
|
|
233
233
|
|
|
234
|
-
#
|
|
235
|
-
CMD ["envsafe", "run", "
|
|
234
|
+
# Inject variables at startup
|
|
235
|
+
CMD ["envsafe", "run", "my-project", "--env", "production", "--", "npm", "start"]
|
|
236
236
|
```
|
|
237
237
|
|
|
238
238
|
---
|
|
239
239
|
|
|
240
|
-
## 💡
|
|
240
|
+
## 💡 Usage Examples
|
|
241
241
|
|
|
242
|
-
###
|
|
242
|
+
### Local Development
|
|
243
243
|
|
|
244
244
|
```bash
|
|
245
|
-
# Option 1
|
|
246
|
-
envsafe pull
|
|
245
|
+
# Option 1: .env file (traditional)
|
|
246
|
+
envsafe pull my-project
|
|
247
247
|
npm run dev
|
|
248
248
|
|
|
249
|
-
# Option 2
|
|
250
|
-
envsafe run
|
|
249
|
+
# Option 2: Direct injection (recommended)
|
|
250
|
+
envsafe run my-project -- npm run dev
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
### Script
|
|
253
|
+
### Deployment Script
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
256
|
#!/bin/bash
|
|
257
257
|
# deploy.sh
|
|
258
258
|
|
|
259
|
-
#
|
|
260
|
-
envsafe run
|
|
261
|
-
envsafe run
|
|
259
|
+
# Load production variables and deploy
|
|
260
|
+
envsafe run my-project --env production -- npm run build
|
|
261
|
+
envsafe run my-project --env production -- npm run deploy
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
### Tests
|
|
264
|
+
### Automated Tests
|
|
265
265
|
|
|
266
266
|
```bash
|
|
267
|
-
#
|
|
268
|
-
envsafe run
|
|
267
|
+
# Run tests with staging variables
|
|
268
|
+
envsafe run my-project --env staging -- npm test
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
### Multi-
|
|
271
|
+
### Multi-environments
|
|
272
272
|
|
|
273
273
|
```bash
|
|
274
|
-
#
|
|
275
|
-
envsafe run
|
|
274
|
+
# Development
|
|
275
|
+
envsafe run my-project --env development -- npm run dev
|
|
276
276
|
|
|
277
277
|
# Staging
|
|
278
|
-
envsafe run
|
|
278
|
+
envsafe run my-project --env staging -- npm run build
|
|
279
279
|
|
|
280
280
|
# Production
|
|
281
|
-
envsafe run
|
|
281
|
+
envsafe run my-project --env production -- npm start
|
|
282
282
|
```
|
|
283
283
|
|
|
284
284
|
---
|
|
285
285
|
|
|
286
|
-
## 🔐
|
|
286
|
+
## 🔐 Security
|
|
287
287
|
|
|
288
|
-
EnvSafe
|
|
288
|
+
EnvSafe uses end-to-end encryption architecture:
|
|
289
289
|
|
|
290
|
-
- **
|
|
291
|
-
- **
|
|
292
|
-
- **Transport
|
|
293
|
-
- **Zero Knowledge
|
|
290
|
+
- **Variable Encryption**: AES-256-GCM
|
|
291
|
+
- **Key Management**: RSA-2048 with asymmetric encryption
|
|
292
|
+
- **Transport**: TLS 1.3
|
|
293
|
+
- **Zero Knowledge**: Your private keys never leave your machine
|
|
294
294
|
|
|
295
|
-
###
|
|
295
|
+
### Best Practices
|
|
296
296
|
|
|
297
|
-
✅
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
-
|
|
297
|
+
✅ **Do:**
|
|
298
|
+
- Use `ENVSAFE_TOKEN` in CI/CD
|
|
299
|
+
- Set expiration dates for your tokens
|
|
300
|
+
- Prefer `envsafe run` to avoid .env files
|
|
301
|
+
- Immediately revoke compromised tokens
|
|
302
302
|
|
|
303
|
-
❌
|
|
304
|
-
-
|
|
305
|
-
-
|
|
306
|
-
-
|
|
303
|
+
❌ **Don't:**
|
|
304
|
+
- Never commit your tokens to Git
|
|
305
|
+
- Do not use `--token` in the command line (visible in history)
|
|
306
|
+
- Do not share your tokens via email/Slack
|
|
307
307
|
|
|
308
308
|
---
|
|
309
309
|
|
|
310
|
-
## 🌍 Variables
|
|
310
|
+
## 🌍 Environment Variables
|
|
311
311
|
|
|
312
|
-
| Variable | Description |
|
|
312
|
+
| Variable | Description | Example |
|
|
313
313
|
|----------|-------------|---------|
|
|
314
|
-
| `ENVSAFE_TOKEN` | Token
|
|
315
|
-
| `ENVSAFE_API_URL` | URL
|
|
314
|
+
| `ENVSAFE_TOKEN` | Authentication Token (recommended in CI/CD) | `es_live_xxx...` |
|
|
315
|
+
| `ENVSAFE_API_URL` | API URL (for self-hosted instances) | `https://api.example.com` |
|
|
316
316
|
|
|
317
317
|
---
|
|
318
318
|
|
|
319
|
-
## 📚 Documentation
|
|
319
|
+
## 📚 Complete Documentation
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
For more information, check out the [official documentation](https://www.envsafe.dev/docs).
|
|
322
322
|
|
|
323
323
|
---
|
|
324
324
|
|
|
325
|
-
## 🐛
|
|
325
|
+
## 🐛 Report a Bug
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
If you encounter an issue, [open an issue](https://github.com/Ifiboys/envsafe-cli/issues).
|
|
328
328
|
|
|
329
329
|
---
|
|
330
330
|
|
|
331
|
-
## 📄
|
|
331
|
+
## 📄 License
|
|
332
332
|
|
|
333
333
|
MIT © EnvSafe Team
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
337
|
-
## 🤝
|
|
337
|
+
## 🤝 Contributing
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
Contributions are welcome! Check out our [contribution guide](CONTRIBUTING.md).
|
|
340
340
|
|
|
341
341
|
---
|
|
342
342
|
|