@dotenvx/dotenvx 0.45.0 → 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/CHANGELOG.md +31 -1
- package/README.md +309 -226
- package/package.json +1 -1
- package/src/cli/actions/{convert.js → encrypt.js} +4 -4
- package/src/cli/actions/{genexample.js → ext/genexample.js} +4 -4
- package/src/cli/actions/{gitignore.js → ext/gitignore.js} +1 -1
- package/src/cli/actions/{hub → ext/hub}/login.js +4 -4
- package/src/cli/actions/{hub → ext/hub}/logout.js +4 -4
- package/src/cli/actions/{hub → ext/hub}/open.js +9 -9
- package/src/cli/actions/{hub → ext/hub}/pull.js +9 -9
- package/src/cli/actions/{hub → ext/hub}/push.js +12 -12
- package/src/cli/actions/{hub → ext/hub}/status.js +2 -2
- package/src/cli/actions/{hub → ext/hub}/token.js +2 -2
- package/src/cli/actions/{ls.js → ext/ls.js} +3 -3
- package/src/cli/actions/{prebuild.js → ext/prebuild.js} +2 -2
- package/src/cli/actions/{precommit.js → ext/precommit.js} +2 -2
- package/src/cli/actions/{scan.js → ext/scan.js} +1 -1
- package/src/cli/actions/{settings.js → ext/settings.js} +2 -2
- package/src/cli/actions/{vault → ext/vault}/decrypt.js +4 -4
- package/src/cli/actions/{vault → ext/vault}/encrypt.js +6 -6
- package/src/cli/actions/{vault → ext/vault}/migrate.js +7 -7
- package/src/cli/actions/{vault → ext/vault}/status.js +2 -2
- package/src/cli/actions/run.js +1 -1
- package/src/cli/actions/set.js +8 -2
- package/src/cli/commands/ext/hub.js +89 -0
- package/src/cli/commands/ext/vault.js +36 -0
- package/src/cli/commands/ext.js +58 -0
- package/src/cli/commands/hub.js +22 -22
- package/src/cli/commands/vault.js +31 -10
- package/src/cli/dotenvx.js +88 -61
- package/src/cli/examples.js +12 -12
- package/src/cli/pro.txt +22 -0
- package/src/lib/helpers/installPrecommitHook.js +5 -5
- package/src/lib/main.js +1 -7
- package/src/lib/services/precommit.js +1 -1
- package/src/lib/services/sets.js +1 -1
- package/src/lib/services/vaultEncrypt.js +2 -2
package/src/cli/commands/hub.js
CHANGED
|
@@ -6,82 +6,82 @@ const { logger } = require('./../../shared/logger')
|
|
|
6
6
|
const hub = new Command('hub')
|
|
7
7
|
|
|
8
8
|
hub
|
|
9
|
-
.description('DEPRECATED:
|
|
9
|
+
.description('DEPRECATED: to be replaced by [dotenvx pro]')
|
|
10
10
|
|
|
11
|
-
const loginAction = require('./../actions/hub/login')
|
|
11
|
+
const loginAction = require('./../actions/ext/hub/login')
|
|
12
12
|
hub
|
|
13
13
|
.command('login')
|
|
14
|
-
.description('
|
|
14
|
+
.description('DEPRECATED: moved to [dotenvx ext hub login]')
|
|
15
15
|
.option('-h, --hostname <url>', 'set hostname', store.getHostname())
|
|
16
16
|
.action(function (...args) {
|
|
17
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub login]
|
|
17
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub login] moved to [dotenvx ext hub login]')
|
|
18
18
|
|
|
19
19
|
loginAction.apply(this, args)
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
const pushAction = require('./../actions/hub/push')
|
|
22
|
+
const pushAction = require('./../actions/ext/hub/push')
|
|
23
23
|
hub
|
|
24
24
|
.command('push')
|
|
25
|
-
.description('
|
|
25
|
+
.description('DEPRECATED: moved to [dotenvx ext hub push]')
|
|
26
26
|
.argument('[directory]', 'directory to push', '.')
|
|
27
27
|
.option('-h, --hostname <url>', 'set hostname', store.getHostname())
|
|
28
28
|
.action(function (...args) {
|
|
29
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub push]
|
|
29
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub push] moved to [dotenvx ext hub push]')
|
|
30
30
|
|
|
31
31
|
pushAction.apply(this, args)
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
const pullAction = require('./../actions/hub/pull')
|
|
34
|
+
const pullAction = require('./../actions/ext/hub/pull')
|
|
35
35
|
hub
|
|
36
36
|
.command('pull')
|
|
37
|
-
.description('
|
|
37
|
+
.description('DEPRECATED: moved to [dotenvx ext hub pull]')
|
|
38
38
|
.argument('[directory]', 'directory to pull', '.')
|
|
39
39
|
.option('-h, --hostname <url>', 'set hostname', store.getHostname())
|
|
40
40
|
.action(function (...args) {
|
|
41
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub pull]
|
|
41
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub pull] moved to [dotenvx ext hub pull]')
|
|
42
42
|
|
|
43
43
|
pullAction.apply(this, args)
|
|
44
44
|
})
|
|
45
45
|
|
|
46
|
-
const openAction = require('./../actions/hub/open')
|
|
46
|
+
const openAction = require('./../actions/ext/hub/open')
|
|
47
47
|
hub
|
|
48
48
|
.command('open')
|
|
49
|
-
.description('
|
|
49
|
+
.description('DEPRECATED: moved to [dotenvx ext hub open]')
|
|
50
50
|
.option('-h, --hostname <url>', 'set hostname', store.getHostname())
|
|
51
51
|
.action(function (...args) {
|
|
52
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub open]
|
|
52
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub open] moved to [dotenvx ext hub open]')
|
|
53
53
|
|
|
54
54
|
openAction.apply(this, args)
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
const tokenAction = require('./../actions/hub/token')
|
|
57
|
+
const tokenAction = require('./../actions/ext/hub/token')
|
|
58
58
|
hub
|
|
59
59
|
.command('token')
|
|
60
|
-
.description('
|
|
60
|
+
.description('DEPRECATED: moved to [dotenvx ext hub token]')
|
|
61
61
|
.option('-h, --hostname <url>', 'set hostname', 'https://hub.dotenvx.com')
|
|
62
62
|
.action(function (...args) {
|
|
63
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub token]
|
|
63
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub token] moved to [dotenvx ext hub token]')
|
|
64
64
|
|
|
65
65
|
tokenAction.apply(this, args)
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
const statusAction = require('./../actions/hub/status')
|
|
68
|
+
const statusAction = require('./../actions/ext/hub/status')
|
|
69
69
|
hub
|
|
70
70
|
.command('status')
|
|
71
|
-
.description('
|
|
71
|
+
.description('DEPRECATED: moved to [dotenvx ext hub status]')
|
|
72
72
|
.action(function (...args) {
|
|
73
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub status]
|
|
73
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub status] moved to [dotenvx ext hub status]')
|
|
74
74
|
|
|
75
75
|
statusAction.apply(this, args)
|
|
76
76
|
})
|
|
77
77
|
|
|
78
|
-
const logoutAction = require('./../actions/hub/logout')
|
|
78
|
+
const logoutAction = require('./../actions/ext/hub/logout')
|
|
79
79
|
hub
|
|
80
80
|
.command('logout')
|
|
81
|
-
.description('
|
|
81
|
+
.description('DEPRECATED: moved to [dotenvx ext hub logout]')
|
|
82
82
|
.option('-h, --hostname <url>', 'set hostname', store.getHostname())
|
|
83
83
|
.action(function (...args) {
|
|
84
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx hub logout]
|
|
84
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx hub logout] moved to [dotenvx ext hub logout]')
|
|
85
85
|
|
|
86
86
|
logoutAction.apply(this, args)
|
|
87
87
|
})
|
|
@@ -1,36 +1,57 @@
|
|
|
1
1
|
const { Command } = require('commander')
|
|
2
2
|
|
|
3
3
|
const examples = require('./../examples')
|
|
4
|
+
const { logger } = require('./../../shared/logger')
|
|
4
5
|
|
|
5
6
|
const vault = new Command('vault')
|
|
6
7
|
|
|
7
8
|
vault
|
|
8
|
-
.description('
|
|
9
|
+
.description('DEPRECATED: moved to [dotenvx ext vault]')
|
|
9
10
|
|
|
10
11
|
// dotenvx vault migrate
|
|
12
|
+
const migrateAction = require('./../actions/ext/vault/migrate')
|
|
11
13
|
vault.command('migrate')
|
|
12
|
-
.description('
|
|
13
|
-
.action(
|
|
14
|
+
.description('DEPRECATED: moved to [dotenvx ext vault migrate]')
|
|
15
|
+
.action(function (...args) {
|
|
16
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx vault migrate] moved to [dotenvx ext vault migrate]')
|
|
17
|
+
|
|
18
|
+
migrateAction.apply(this, args)
|
|
19
|
+
})
|
|
14
20
|
|
|
15
21
|
// dotenvx vault encrypt
|
|
22
|
+
const encryptAction = require('./../actions/ext/vault/encrypt')
|
|
16
23
|
vault.command('encrypt')
|
|
17
|
-
.description('
|
|
18
|
-
.addHelpText('after', examples.
|
|
24
|
+
.description('DEPRECATED: moved to [dotenvx ext vault encrypt]')
|
|
25
|
+
.addHelpText('after', examples.vaultEncrypt)
|
|
19
26
|
.argument('[directory]', 'directory to encrypt', '.')
|
|
20
27
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
21
|
-
.action(
|
|
28
|
+
.action(function (...args) {
|
|
29
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx vault encrypt] moved to [dotenvx ext vault encrypt]')
|
|
30
|
+
|
|
31
|
+
encryptAction.apply(this, args)
|
|
32
|
+
})
|
|
22
33
|
|
|
23
34
|
// dotenvx vault decrypt
|
|
35
|
+
const decryptAction = require('./../actions/ext/vault/decrypt')
|
|
24
36
|
vault.command('decrypt')
|
|
25
|
-
.description('
|
|
37
|
+
.description('DEPRECATED: moved to [dotenvx ext vault decrypt]')
|
|
26
38
|
.argument('[directory]', 'directory to decrypt', '.')
|
|
27
39
|
.option('-e, --environment <environments...>', 'environment(s) to decrypt')
|
|
28
|
-
.action(
|
|
40
|
+
.action(function (...args) {
|
|
41
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx vault decrypt] moved to [dotenvx ext vault decrypt]')
|
|
42
|
+
|
|
43
|
+
decryptAction.apply(this, args)
|
|
44
|
+
})
|
|
29
45
|
|
|
30
46
|
// dotenvx vault status
|
|
47
|
+
const statusAction = require('./../actions/ext/vault/status')
|
|
31
48
|
vault.command('status')
|
|
32
|
-
.description('
|
|
49
|
+
.description('DEPRECATED: moved to [dotenvx ext vault status]')
|
|
33
50
|
.argument('[directory]', 'directory to check status against', '.')
|
|
34
|
-
.action(
|
|
51
|
+
.action(function (...args) {
|
|
52
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx vault status] moved to [dotenvx ext vault status]')
|
|
53
|
+
|
|
54
|
+
statusAction.apply(this, args)
|
|
55
|
+
})
|
|
35
56
|
|
|
36
57
|
module.exports = vault
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
3
5
|
const UpdateNotice = require('./../lib/helpers/updateNotice')
|
|
4
6
|
const { Command } = require('commander')
|
|
5
7
|
const program = new Command()
|
|
@@ -82,101 +84,126 @@ program.command('set')
|
|
|
82
84
|
.argument('KEY', 'KEY')
|
|
83
85
|
.argument('value', 'value')
|
|
84
86
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)', '.env')
|
|
85
|
-
.option('-c, --encrypt', 'encrypt value')
|
|
87
|
+
.option('-c, --encrypt', 'encrypt value (default: true)', true)
|
|
88
|
+
.option('-p, --plain', 'store value as plain text', false)
|
|
86
89
|
.action(require('./actions/set'))
|
|
87
90
|
|
|
88
|
-
// dotenvx
|
|
91
|
+
// dotenvx encrypt
|
|
92
|
+
const encryptAction = require('./actions/encrypt')
|
|
93
|
+
program.command('encrypt')
|
|
94
|
+
.description('convert .env file(s) to encrypted .env file(s)')
|
|
95
|
+
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
96
|
+
.action(encryptAction)
|
|
97
|
+
|
|
98
|
+
// dotenvx pro
|
|
99
|
+
program.command('pro')
|
|
100
|
+
.description('🏆 pro')
|
|
101
|
+
.action(function (...args) {
|
|
102
|
+
const pro = fs.readFileSync(path.join(__dirname, './pro.txt'), 'utf8')
|
|
103
|
+
|
|
104
|
+
console.log(pro)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// // dotenvx ent
|
|
108
|
+
// program.command('ent')
|
|
109
|
+
// .description('🏢 enterprise')
|
|
110
|
+
// .action(function (...args) {
|
|
111
|
+
// console.log('coming soon (med-large companies)')
|
|
112
|
+
// })
|
|
113
|
+
|
|
114
|
+
// dotenvx ext
|
|
115
|
+
program.addCommand(require('./commands/ext'))
|
|
116
|
+
|
|
117
|
+
//
|
|
118
|
+
// DEPRECATED AND hidden
|
|
119
|
+
//
|
|
120
|
+
program.addCommand(require('./commands/hub'))
|
|
121
|
+
program.addCommand(require('./commands/vault'))
|
|
122
|
+
|
|
89
123
|
program.command('convert')
|
|
90
|
-
.description('
|
|
124
|
+
.description('DEPRECATED: moved to [dotenvx encrypt]')
|
|
91
125
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
92
|
-
.action(
|
|
126
|
+
.action(function (...args) {
|
|
127
|
+
logger.warn('DEPRECATION NOTICE: [dotenvx convert] has moved to [dotenvx encrypt]')
|
|
128
|
+
|
|
129
|
+
encryptAction.apply(this, args)
|
|
130
|
+
})
|
|
93
131
|
|
|
94
|
-
|
|
132
|
+
const lsAction = require('./actions/ext/ls')
|
|
95
133
|
program.command('ls')
|
|
96
|
-
.description('
|
|
134
|
+
.description('DEPRECATED: moved to [dotenvx ext ls]')
|
|
97
135
|
.argument('[directory]', 'directory to list .env files from', '.')
|
|
98
136
|
.option('-f, --env-file <filenames...>', 'path(s) to your env file(s)', '.env*')
|
|
99
|
-
.action(
|
|
137
|
+
.action(function (...args) {
|
|
138
|
+
logger.warn('DEPRECATION NOTICE: [ls] has moved to [dotenvx ext ls]')
|
|
100
139
|
|
|
101
|
-
|
|
140
|
+
lsAction.apply(this, args)
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
const genexampleAction = require('./actions/ext/genexample')
|
|
102
144
|
program.command('genexample')
|
|
103
|
-
.description('
|
|
145
|
+
.description('DEPRECATED: moved to [dotenvx ext genexample]')
|
|
104
146
|
.argument('[directory]', 'directory to generate from', '.')
|
|
105
147
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)', '.env')
|
|
106
|
-
.action(
|
|
148
|
+
.action(function (...args) {
|
|
149
|
+
logger.warn('DEPRECATION NOTICE: [genexample] has moved to [dotenvx ext genexample]')
|
|
150
|
+
|
|
151
|
+
genexampleAction.apply(this, args)
|
|
152
|
+
})
|
|
107
153
|
|
|
108
154
|
// dotenvx gitignore
|
|
155
|
+
const gitignoreAction = require('./actions/ext/gitignore')
|
|
109
156
|
program.command('gitignore')
|
|
110
|
-
.description('
|
|
157
|
+
.description('DEPRECATED: moved to [dotenvx ext gitignore]')
|
|
111
158
|
.addHelpText('after', examples.gitignore)
|
|
112
|
-
.action(
|
|
159
|
+
.action(function (...args) {
|
|
160
|
+
logger.warn('DEPRECATION NOTICE: [gitignore] has moved to [dotenvx ext gitignore]')
|
|
161
|
+
|
|
162
|
+
gitignoreAction.apply(this, args)
|
|
163
|
+
})
|
|
113
164
|
|
|
114
165
|
// dotenvx prebuild
|
|
166
|
+
const prebuildAction = require('./actions/ext/prebuild')
|
|
115
167
|
program.command('prebuild')
|
|
116
|
-
.description('
|
|
168
|
+
.description('DEPRECATED: moved to [dotenvx ext prebuild]')
|
|
117
169
|
.addHelpText('after', examples.prebuild)
|
|
118
|
-
.action(
|
|
170
|
+
.action(function (...args) {
|
|
171
|
+
logger.warn('DEPRECATION NOTICE: [prebuild] has moved to [dotenvx ext prebuild]')
|
|
172
|
+
|
|
173
|
+
prebuildAction.apply(this, args)
|
|
174
|
+
})
|
|
119
175
|
|
|
120
176
|
// dotenvx precommit
|
|
177
|
+
const precommitAction = require('./actions/ext/precommit')
|
|
121
178
|
program.command('precommit')
|
|
122
|
-
.description('
|
|
179
|
+
.description('DEPRECATED: moved to [dotenvx ext precommit]')
|
|
123
180
|
.addHelpText('after', examples.precommit)
|
|
124
181
|
.option('-i, --install', 'install to .git/hooks/pre-commit')
|
|
125
|
-
.action(require('./actions/precommit'))
|
|
126
|
-
|
|
127
|
-
// dotenvx scan
|
|
128
|
-
program.command('scan')
|
|
129
|
-
.description('scan for leaked secrets')
|
|
130
|
-
.action(require('./actions/scan'))
|
|
131
|
-
|
|
132
|
-
// dotenvx settings
|
|
133
|
-
program.command('settings')
|
|
134
|
-
.description('print current dotenvx settings')
|
|
135
|
-
.argument('[key]', 'settings name')
|
|
136
|
-
.option('-pp, --pretty-print', 'pretty print output')
|
|
137
|
-
.action(require('./actions/settings'))
|
|
138
|
-
|
|
139
|
-
// dotenvx vault
|
|
140
|
-
program.addCommand(require('./commands/vault'))
|
|
141
|
-
|
|
142
|
-
// dotenvx encrypt
|
|
143
|
-
const encryptAction = require('./actions/vault/encrypt')
|
|
144
|
-
program.command('encrypt')
|
|
145
|
-
.description('DEPRECATED: moved to [dotenvx vault encrypt]')
|
|
146
|
-
.addHelpText('after', examples.encrypt)
|
|
147
|
-
.argument('[directory]', 'directory to encrypt', '.')
|
|
148
|
-
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
149
182
|
.action(function (...args) {
|
|
150
|
-
logger.warn('DEPRECATION NOTICE: [
|
|
151
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx encryptme] will become [dotenvx encrypt] in a 1.0.0 release scheduled for middle of June 2024.')
|
|
183
|
+
logger.warn('DEPRECATION NOTICE: [precommit] has moved to [dotenvx ext precommit]')
|
|
152
184
|
|
|
153
|
-
|
|
185
|
+
precommitAction.apply(this, args)
|
|
154
186
|
})
|
|
155
187
|
|
|
156
|
-
// dotenvx
|
|
157
|
-
const
|
|
158
|
-
program.command('
|
|
159
|
-
.description('DEPRECATED: moved to [dotenvx
|
|
160
|
-
.argument('[directory]', 'directory to decrypt', '.')
|
|
161
|
-
.option('-e, --environment <environments...>', 'environment(s) to decrypt')
|
|
188
|
+
// dotenvx scan
|
|
189
|
+
const scanAction = require('./actions/ext/scan')
|
|
190
|
+
program.command('scan')
|
|
191
|
+
.description('DEPRECATED: moved to [dotenvx ext scan]')
|
|
162
192
|
.action(function (...args) {
|
|
163
|
-
logger.warn('DEPRECATION NOTICE: [
|
|
193
|
+
logger.warn('DEPRECATION NOTICE: [scan] has moved to [dotenvx ext scan]')
|
|
164
194
|
|
|
165
|
-
|
|
195
|
+
scanAction.apply(this, args)
|
|
166
196
|
})
|
|
167
197
|
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.argument('[directory]', 'directory to check status against', '.')
|
|
173
|
-
.action(function (...args) {
|
|
174
|
-
logger.warn('DEPRECATION NOTICE: [dotenvx status] has moved. change your command to [dotenvx vault status]')
|
|
198
|
+
// overide helpInformation to hide DEPRECATED commands
|
|
199
|
+
program.helpInformation = function () {
|
|
200
|
+
const originalHelp = Command.prototype.helpInformation.call(this)
|
|
201
|
+
const lines = originalHelp.split('\n')
|
|
175
202
|
|
|
176
|
-
|
|
177
|
-
|
|
203
|
+
// Filter out the hidden command from the help output
|
|
204
|
+
const filteredLines = lines.filter(line => !line.includes('DEPRECATED'))
|
|
178
205
|
|
|
179
|
-
|
|
180
|
-
|
|
206
|
+
return filteredLines.join('\n')
|
|
207
|
+
}
|
|
181
208
|
|
|
182
209
|
program.parse(process.argv)
|
package/src/cli/examples.js
CHANGED
|
@@ -22,12 +22,12 @@ Try it:
|
|
|
22
22
|
`
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const vaultEncrypt = function () {
|
|
26
26
|
return `
|
|
27
27
|
Examples:
|
|
28
28
|
|
|
29
29
|
\`\`\`
|
|
30
|
-
$ dotenvx encrypt
|
|
30
|
+
$ dotenvx ext vault encrypt
|
|
31
31
|
\`\`\`
|
|
32
32
|
|
|
33
33
|
Try it:
|
|
@@ -37,7 +37,7 @@ Try it:
|
|
|
37
37
|
$ echo "HELLO=production" > .env.production
|
|
38
38
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
39
39
|
|
|
40
|
-
$ dotenvx encrypt
|
|
40
|
+
$ dotenvx ext vault encrypt
|
|
41
41
|
encrypted to .env.vault (.env,.env.production)
|
|
42
42
|
keys added to .env.keys (DOTENV_KEY_PRODUCTION,DOTENV_KEY_PRODUCTION)
|
|
43
43
|
|
|
@@ -53,15 +53,15 @@ const precommit = function () {
|
|
|
53
53
|
Examples:
|
|
54
54
|
|
|
55
55
|
\`\`\`
|
|
56
|
-
$ dotenvx precommit
|
|
57
|
-
$ dotenvx precommit --install
|
|
56
|
+
$ dotenvx ext precommit
|
|
57
|
+
$ dotenvx ext precommit --install
|
|
58
58
|
\`\`\`
|
|
59
59
|
|
|
60
60
|
Try it:
|
|
61
61
|
|
|
62
62
|
\`\`\`
|
|
63
|
-
$ dotenvx precommit
|
|
64
|
-
[dotenvx@0.
|
|
63
|
+
$ dotenvx ext precommit
|
|
64
|
+
[dotenvx@0.45.0][precommit] success
|
|
65
65
|
\`\`\`
|
|
66
66
|
`
|
|
67
67
|
}
|
|
@@ -71,13 +71,13 @@ const prebuild = function () {
|
|
|
71
71
|
Examples:
|
|
72
72
|
|
|
73
73
|
\`\`\`
|
|
74
|
-
$ dotenvx prebuild
|
|
74
|
+
$ dotenvx ext prebuild
|
|
75
75
|
\`\`\`
|
|
76
76
|
|
|
77
77
|
Try it:
|
|
78
78
|
|
|
79
79
|
\`\`\`
|
|
80
|
-
$ dotenvx prebuild
|
|
80
|
+
$ dotenvx ext prebuild
|
|
81
81
|
[dotenvx@0.10.0][prebuild] success
|
|
82
82
|
\`\`\`
|
|
83
83
|
`
|
|
@@ -88,13 +88,13 @@ const gitignore = function () {
|
|
|
88
88
|
Examples:
|
|
89
89
|
|
|
90
90
|
\`\`\`
|
|
91
|
-
$ dotenvx gitignore
|
|
91
|
+
$ dotenvx ext gitignore
|
|
92
92
|
\`\`\`
|
|
93
93
|
|
|
94
94
|
Try it:
|
|
95
95
|
|
|
96
96
|
\`\`\`
|
|
97
|
-
$ dotenvx gitignore
|
|
97
|
+
$ dotenvx ext gitignore
|
|
98
98
|
done
|
|
99
99
|
\`\`\`
|
|
100
100
|
`
|
|
@@ -102,7 +102,7 @@ Try it:
|
|
|
102
102
|
|
|
103
103
|
module.exports = {
|
|
104
104
|
run,
|
|
105
|
-
|
|
105
|
+
vaultEncrypt,
|
|
106
106
|
precommit,
|
|
107
107
|
prebuild,
|
|
108
108
|
gitignore
|
package/src/cli/pro.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
_______________________________________________________________
|
|
2
|
+
| |
|
|
3
|
+
| coming soon! (for small business) |
|
|
4
|
+
| |
|
|
5
|
+
| | | | | |
|
|
6
|
+
| __| | ___ | |_ ___ _ ____ ____ __ _ __ _ __ ___ |
|
|
7
|
+
| / _` |/ _ \| __/ _ \ '_ \ \ / /\ \/ / | '_ \| '__/ _ \ |
|
|
8
|
+
| | (_| | (_) | || __/ | | \ V / > < | |_) | | | (_) | |
|
|
9
|
+
| \__,_|\___/ \__\___|_| |_|\_/ /_/\_\ | .__/|_| \___/ |
|
|
10
|
+
| | | |
|
|
11
|
+
| |_| |
|
|
12
|
+
| ## learn more on github 🐙 |
|
|
13
|
+
| |
|
|
14
|
+
| >> https://github.com/dotenvx/dotenvx/issues/259 |
|
|
15
|
+
| |
|
|
16
|
+
| ## subscribe on github to be notified 📣 |
|
|
17
|
+
| |
|
|
18
|
+
| >> https://github.com/dotenvx/dotenvx/issues/259 |
|
|
19
|
+
| |
|
|
20
|
+
| ----------------------------------------------------------- |
|
|
21
|
+
| - thank you for using dotenvx! - @motdotla |
|
|
22
|
+
|_____________________________________________________________|
|
|
@@ -11,7 +11,7 @@ then
|
|
|
11
11
|
exit 1
|
|
12
12
|
fi
|
|
13
13
|
|
|
14
|
-
dotenvx precommit`
|
|
14
|
+
dotenvx ext precommit`
|
|
15
15
|
|
|
16
16
|
class InstallPrecommitHook {
|
|
17
17
|
constructor () {
|
|
@@ -25,16 +25,16 @@ class InstallPrecommitHook {
|
|
|
25
25
|
// Check if the pre-commit file already exists
|
|
26
26
|
if (this._exists()) {
|
|
27
27
|
// Check if 'dotenvx precommit' already exists in the file
|
|
28
|
-
if (this._currentHook().includes('dotenvx precommit')) {
|
|
28
|
+
if (this._currentHook().includes('dotenvx ext precommit')) {
|
|
29
29
|
// do nothing
|
|
30
|
-
successMessage = `dotenvx precommit exists [${this.hookPath}]`
|
|
30
|
+
successMessage = `dotenvx ext precommit exists [${this.hookPath}]`
|
|
31
31
|
} else {
|
|
32
32
|
this._appendHook()
|
|
33
|
-
successMessage = `dotenvx precommit appended [${this.hookPath}]`
|
|
33
|
+
successMessage = `dotenvx ext precommit appended [${this.hookPath}]`
|
|
34
34
|
}
|
|
35
35
|
} else {
|
|
36
36
|
this._createHook()
|
|
37
|
-
successMessage = `dotenvx precommit installed [${this.hookPath}]`
|
|
37
|
+
successMessage = `dotenvx ext precommit installed [${this.hookPath}]`
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return {
|
package/src/lib/main.js
CHANGED
|
@@ -134,11 +134,6 @@ const parse = function (src) {
|
|
|
134
134
|
return dotenv.parse(src)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// DEPRECATED: will became the same function as convert
|
|
138
|
-
const encrypt = function (directory, envFile) {
|
|
139
|
-
return new VaultEncrypt(directory, envFile).run()
|
|
140
|
-
}
|
|
141
|
-
|
|
142
137
|
const vaultEncrypt = function (directory, envFile) {
|
|
143
138
|
return new VaultEncrypt(directory, envFile).run()
|
|
144
139
|
}
|
|
@@ -159,7 +154,7 @@ const set = function (key, value, envFile, encrypt) {
|
|
|
159
154
|
return new Sets(key, value, envFile, encrypt).run()
|
|
160
155
|
}
|
|
161
156
|
|
|
162
|
-
const
|
|
157
|
+
const encrypt = function (envFile) {
|
|
163
158
|
return new Encrypt(envFile).run()
|
|
164
159
|
}
|
|
165
160
|
|
|
@@ -201,7 +196,6 @@ module.exports = {
|
|
|
201
196
|
ls,
|
|
202
197
|
get,
|
|
203
198
|
set,
|
|
204
|
-
convert,
|
|
205
199
|
status,
|
|
206
200
|
genexample,
|
|
207
201
|
// settings
|
|
@@ -56,7 +56,7 @@ class Precommit {
|
|
|
56
56
|
// if contents are encrypted don't raise an error
|
|
57
57
|
if (!encrypted) {
|
|
58
58
|
const error = new Error(`${file} not encrypted (or not gitignored)`)
|
|
59
|
-
error.help = `? encrypt it with [dotenvx
|
|
59
|
+
error.help = `? encrypt it with [dotenvx encrypt -f ${file}] or add ${file} to .gitignore with [echo ".env*" >> .gitignore]`
|
|
60
60
|
throw error
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/lib/services/sets.js
CHANGED
|
@@ -11,7 +11,7 @@ const replace = require('./../helpers/replace')
|
|
|
11
11
|
const ENCODING = 'utf8'
|
|
12
12
|
|
|
13
13
|
class Sets {
|
|
14
|
-
constructor (key, value, envFile = '.env', encrypt =
|
|
14
|
+
constructor (key, value, envFile = '.env', encrypt = true) {
|
|
15
15
|
this.key = key
|
|
16
16
|
this.value = value
|
|
17
17
|
this.envFile = envFile
|
|
@@ -22,7 +22,7 @@ class VaultEncrypt {
|
|
|
22
22
|
if (this.envFile.length < 1) {
|
|
23
23
|
const code = 'MISSING_ENV_FILES'
|
|
24
24
|
const message = 'no .env* files found'
|
|
25
|
-
const help = '? add one with [echo "HELLO=World" > .env] and then run [dotenvx vault encrypt]'
|
|
25
|
+
const help = '? add one with [echo "HELLO=World" > .env] and then run [dotenvx ext vault encrypt]'
|
|
26
26
|
|
|
27
27
|
const error = new Error(message)
|
|
28
28
|
error.code = code
|
|
@@ -41,7 +41,7 @@ class VaultEncrypt {
|
|
|
41
41
|
if (!fs.existsSync(filepath)) {
|
|
42
42
|
const code = 'MISSING_ENV_FILE'
|
|
43
43
|
const message = `file does not exist at [${filepath}]`
|
|
44
|
-
const help = `? add it with [echo "HELLO=World" > ${envFilepath}] and then run [dotenvx vault encrypt]`
|
|
44
|
+
const help = `? add it with [echo "HELLO=World" > ${envFilepath}] and then run [dotenvx ext vault encrypt]`
|
|
45
45
|
|
|
46
46
|
const error = new Error(message)
|
|
47
47
|
error.code = code
|