@dotenvx/dotenvx 1.40.1 → 1.41.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
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.41.0...main)
|
|
6
|
+
|
|
7
|
+
## [1.41.0](https://github.com/dotenvx/dotenvx/compare/v1.40.1...v1.41.0)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Add [directory] argument to precommit and prebuild ([#572](https://github.com/dotenvx/dotenvx/pull/572))
|
|
6
12
|
|
|
7
13
|
## [1.40.1](https://github.com/dotenvx/dotenvx/compare/v1.40.0...v1.40.1)
|
|
8
14
|
|
package/README.md
CHANGED
|
@@ -2079,6 +2079,16 @@ CLI extensions.
|
|
|
2079
2079
|
[dotenvx][precommit] dotenvx ext precommit installed [.git/hooks/pre-commit]
|
|
2080
2080
|
```
|
|
2081
2081
|
|
|
2082
|
+
</details>
|
|
2083
|
+
* <details><summary>`ext precommit directory`</summary><br>
|
|
2084
|
+
|
|
2085
|
+
Prevent `.env` files from being committed to code inside a specified path to a directory.
|
|
2086
|
+
|
|
2087
|
+
```sh
|
|
2088
|
+
$ dotenvx ext precommit apps/backend
|
|
2089
|
+
[dotenvx][precommit] .env files (1) protected (encrypted or gitignored)
|
|
2090
|
+
```
|
|
2091
|
+
|
|
2082
2092
|
</details>
|
|
2083
2093
|
* <details><summary>`ext prebuild`</summary><br>
|
|
2084
2094
|
|
|
@@ -2097,23 +2107,35 @@ CLI extensions.
|
|
|
2097
2107
|
```
|
|
2098
2108
|
|
|
2099
2109
|
</details>
|
|
2100
|
-
* <details><summary>`ext
|
|
2110
|
+
* <details><summary>`ext prebuild directory`</summary><br>
|
|
2111
|
+
|
|
2112
|
+
Prevent `.env` files from being built into your docker containers inside a specified path to a directory.
|
|
2101
2113
|
|
|
2102
|
-
|
|
2114
|
+
Add it to your `Dockerfile`.
|
|
2103
2115
|
|
|
2104
2116
|
```sh
|
|
2105
|
-
|
|
2117
|
+
# Dockerfile
|
|
2118
|
+
RUN curl -fsS https://dotenvx.sh | sh
|
|
2106
2119
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2120
|
+
...
|
|
2121
|
+
|
|
2122
|
+
RUN dotenvx ext prebuild apps/backend
|
|
2123
|
+
CMD ["dotenvx", "run", "--", "node", "index.js"]
|
|
2124
|
+
```
|
|
2125
|
+
|
|
2126
|
+
</details>
|
|
2127
|
+
* <details><summary>`ext scan`</summary><br>
|
|
2128
|
+
|
|
2129
|
+
Scan for leaked secrets.
|
|
2112
2130
|
|
|
2131
|
+
```sh
|
|
2132
|
+
$ dotenvx ext scan
|
|
2113
2133
|
100 commits scanned.
|
|
2114
2134
|
no leaks found
|
|
2115
2135
|
```
|
|
2116
2136
|
|
|
2137
|
+
Uses [gitleaks](https://gitleaks.io) under the hood.
|
|
2138
|
+
|
|
2117
2139
|
</details>
|
|
2118
2140
|
|
|
2119
2141
|
### Library 📦
|
|
@@ -2342,6 +2364,8 @@ Use dotenvx directly in code.
|
|
|
2342
2364
|
|
|
2343
2365
|
### Pro 🏆
|
|
2344
2366
|
|
|
2367
|
+
> Dotenvx Pro is a commercial extension for [dotenvx](https://github.com/dotenvx/dotenvx).
|
|
2368
|
+
|
|
2345
2369
|
*Secrets Management – Done Right. Encrypted, Cloaked, Secrets as Code.*
|
|
2346
2370
|
|
|
2347
2371
|
* <details><summary>`pro keypair`</summary><br>
|
package/package.json
CHANGED
|
@@ -2,7 +2,10 @@ const { logger } = require('./../../../shared/logger')
|
|
|
2
2
|
|
|
3
3
|
const Prebuild = require('./../../../lib/services/prebuild')
|
|
4
4
|
|
|
5
|
-
function prebuild () {
|
|
5
|
+
function prebuild (directory) {
|
|
6
|
+
// debug args
|
|
7
|
+
logger.debug(`directory: ${directory}`)
|
|
8
|
+
|
|
6
9
|
const options = this.opts()
|
|
7
10
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
8
11
|
|
|
@@ -10,7 +13,7 @@ function prebuild () {
|
|
|
10
13
|
const {
|
|
11
14
|
successMessage,
|
|
12
15
|
warnings
|
|
13
|
-
} = new Prebuild(options).run()
|
|
16
|
+
} = new Prebuild(directory, options).run()
|
|
14
17
|
|
|
15
18
|
for (const warning of warnings) {
|
|
16
19
|
logger.warn(warning.message)
|
|
@@ -2,7 +2,10 @@ const { logger } = require('./../../../shared/logger')
|
|
|
2
2
|
|
|
3
3
|
const Precommit = require('./../../../lib/services/precommit')
|
|
4
4
|
|
|
5
|
-
function precommit () {
|
|
5
|
+
function precommit (directory) {
|
|
6
|
+
// debug args
|
|
7
|
+
logger.debug(`directory: ${directory}`)
|
|
8
|
+
|
|
6
9
|
const options = this.opts()
|
|
7
10
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
8
11
|
|
|
@@ -10,7 +13,7 @@ function precommit () {
|
|
|
10
13
|
const {
|
|
11
14
|
successMessage,
|
|
12
15
|
warnings
|
|
13
|
-
} = new Precommit(options).run()
|
|
16
|
+
} = new Precommit(directory, options).run()
|
|
14
17
|
|
|
15
18
|
for (const warning of warnings) {
|
|
16
19
|
logger.warn(warning.message)
|
package/src/cli/commands/ext.js
CHANGED
|
@@ -47,12 +47,14 @@ ext.command('gitignore')
|
|
|
47
47
|
ext.command('prebuild')
|
|
48
48
|
.description('prevent including .env files in docker builds')
|
|
49
49
|
.addHelpText('after', examples.prebuild)
|
|
50
|
+
.argument('[directory]', 'directory to prevent including .env files from', '.')
|
|
50
51
|
.action(require('./../actions/ext/prebuild'))
|
|
51
52
|
|
|
52
53
|
// dotenvx ext precommit
|
|
53
54
|
ext.command('precommit')
|
|
54
55
|
.description('prevent committing .env files to code')
|
|
55
56
|
.addHelpText('after', examples.precommit)
|
|
57
|
+
.argument('[directory]', 'directory to prevent committing .env files from', '.')
|
|
56
58
|
.option('-i, --install', 'install to .git/hooks/pre-commit')
|
|
57
59
|
.action(require('./../actions/ext/precommit'))
|
|
58
60
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
const fsx = require('./../helpers/fsx')
|
|
3
|
+
const path = require('path')
|
|
3
4
|
const ignore = require('ignore')
|
|
4
5
|
|
|
5
6
|
const Ls = require('../services/ls')
|
|
@@ -9,7 +10,10 @@ const packageJson = require('./../helpers/packageJson')
|
|
|
9
10
|
const MISSING_DOCKERIGNORE = '.env.keys' // by default only ignore .env.keys. all other .env* files COULD be included - as long as they are encrypted
|
|
10
11
|
|
|
11
12
|
class Prebuild {
|
|
12
|
-
constructor () {
|
|
13
|
+
constructor (directory = './') {
|
|
14
|
+
// args
|
|
15
|
+
this.directory = directory
|
|
16
|
+
|
|
13
17
|
this.excludeEnvFile = ['test/**', 'tests/**', 'spec/**', 'specs/**', 'pytest/**', 'test_suite/**']
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -28,11 +32,13 @@ class Prebuild {
|
|
|
28
32
|
|
|
29
33
|
// 2. check .env* files against .dockerignore file
|
|
30
34
|
const ig = ignore().add(dockerignore)
|
|
31
|
-
const lsService = new Ls(
|
|
35
|
+
const lsService = new Ls(this.directory, undefined, this.excludeEnvFile)
|
|
32
36
|
const dotenvFiles = lsService.run()
|
|
33
|
-
dotenvFiles.forEach(
|
|
37
|
+
dotenvFiles.forEach(_file => {
|
|
34
38
|
count += 1
|
|
35
39
|
|
|
40
|
+
const file = path.join(this.directory, _file) // to handle when directory argument passed
|
|
41
|
+
|
|
36
42
|
// check if that file is being ignored
|
|
37
43
|
if (ig.ignores(file)) {
|
|
38
44
|
if (file === '.env.example' || file === '.env.vault') {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
const fsx = require('./../helpers/fsx')
|
|
3
|
+
const path = require('path')
|
|
3
4
|
const ignore = require('ignore')
|
|
4
5
|
|
|
5
6
|
const Ls = require('../services/ls')
|
|
@@ -11,7 +12,10 @@ const childProcess = require('child_process')
|
|
|
11
12
|
const MISSING_GITIGNORE = '.env.keys' // by default only ignore .env.keys. all other .env* files COULD be included - as long as they are encrypted
|
|
12
13
|
|
|
13
14
|
class Precommit {
|
|
14
|
-
constructor (options = {}) {
|
|
15
|
+
constructor (directory = './', options = {}) {
|
|
16
|
+
// args
|
|
17
|
+
this.directory = directory
|
|
18
|
+
// options
|
|
15
19
|
this.install = options.install
|
|
16
20
|
this.excludeEnvFile = ['test/**', 'tests/**', 'spec/**', 'specs/**', 'pytest/**', 'test_suite/**']
|
|
17
21
|
}
|
|
@@ -41,11 +45,14 @@ class Precommit {
|
|
|
41
45
|
|
|
42
46
|
// 2. check .env* files against .gitignore file
|
|
43
47
|
const ig = ignore().add(gitignore)
|
|
44
|
-
|
|
48
|
+
|
|
49
|
+
const lsService = new Ls(this.directory, undefined, this.excludeEnvFile)
|
|
45
50
|
const dotenvFiles = lsService.run()
|
|
46
|
-
dotenvFiles.forEach(
|
|
51
|
+
dotenvFiles.forEach(_file => {
|
|
47
52
|
count += 1
|
|
48
53
|
|
|
54
|
+
const file = path.join(this.directory, _file) // to handle when directory argument passed
|
|
55
|
+
|
|
49
56
|
// check if file is going to be committed
|
|
50
57
|
if (this._isFileToBeCommitted(file)) {
|
|
51
58
|
// check if that file is being ignored
|