@dotenvx/dotenvx 1.40.1 → 1.42.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,19 @@
|
|
|
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.42.0...main)
|
|
6
|
+
|
|
7
|
+
## [1.42.0](https://github.com/dotenvx/dotenvx/compare/v1.41.0...v1.42.0)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Add ability to override the `os` and `arch` via `install.sh` and `dotenvx.sh` ([3ded752](https://github.com/dotenvx/dotenvx/commit/3ded752fbe60aa4eeebe9fe90a87f35dba502a76))
|
|
12
|
+
|
|
13
|
+
## [1.41.0](https://github.com/dotenvx/dotenvx/compare/v1.40.1...v1.41.0)
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
* Add [directory] argument to precommit and prebuild ([#572](https://github.com/dotenvx/dotenvx/pull/572))
|
|
6
18
|
|
|
7
19
|
## [1.40.1](https://github.com/dotenvx/dotenvx/compare/v1.40.0...v1.40.1)
|
|
8
20
|
|
package/README.md
CHANGED
|
@@ -2079,6 +2079,20 @@ 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
|
+
$ echo "HELLO=World" > .env
|
|
2089
|
+
$ mkdir -p apps/backend
|
|
2090
|
+
$ echo "HELLO=Backend" > apps/backend/.env
|
|
2091
|
+
|
|
2092
|
+
$ dotenvx ext precommit apps/backend
|
|
2093
|
+
[dotenvx][precommit] apps/backend/.env not protected (encrypted or gitignored)
|
|
2094
|
+
```
|
|
2095
|
+
|
|
2082
2096
|
</details>
|
|
2083
2097
|
* <details><summary>`ext prebuild`</summary><br>
|
|
2084
2098
|
|
|
@@ -2097,23 +2111,35 @@ CLI extensions.
|
|
|
2097
2111
|
```
|
|
2098
2112
|
|
|
2099
2113
|
</details>
|
|
2100
|
-
* <details><summary>`ext
|
|
2114
|
+
* <details><summary>`ext prebuild directory`</summary><br>
|
|
2101
2115
|
|
|
2102
|
-
|
|
2116
|
+
Prevent `.env` files from being built into your docker containers inside a specified path to a directory.
|
|
2117
|
+
|
|
2118
|
+
Add it to your `Dockerfile`.
|
|
2103
2119
|
|
|
2104
2120
|
```sh
|
|
2105
|
-
|
|
2121
|
+
# Dockerfile
|
|
2122
|
+
RUN curl -fsS https://dotenvx.sh | sh
|
|
2106
2123
|
|
|
2107
|
-
|
|
2108
|
-
│╲
|
|
2109
|
-
│ ○
|
|
2110
|
-
○ ░
|
|
2111
|
-
░ gitleaks
|
|
2124
|
+
...
|
|
2112
2125
|
|
|
2126
|
+
RUN dotenvx ext prebuild apps/backend
|
|
2127
|
+
CMD ["dotenvx", "run", "--", "node", "apps/backend/index.js"]
|
|
2128
|
+
```
|
|
2129
|
+
|
|
2130
|
+
</details>
|
|
2131
|
+
* <details><summary>`ext scan`</summary><br>
|
|
2132
|
+
|
|
2133
|
+
Scan for leaked secrets.
|
|
2134
|
+
|
|
2135
|
+
```sh
|
|
2136
|
+
$ dotenvx ext scan
|
|
2113
2137
|
100 commits scanned.
|
|
2114
2138
|
no leaks found
|
|
2115
2139
|
```
|
|
2116
2140
|
|
|
2141
|
+
Uses [gitleaks](https://gitleaks.io) under the hood.
|
|
2142
|
+
|
|
2117
2143
|
</details>
|
|
2118
2144
|
|
|
2119
2145
|
### Library 📦
|
|
@@ -2342,6 +2368,8 @@ Use dotenvx directly in code.
|
|
|
2342
2368
|
|
|
2343
2369
|
### Pro 🏆
|
|
2344
2370
|
|
|
2371
|
+
> Dotenvx Pro is a commercial extension for [dotenvx](https://github.com/dotenvx/dotenvx).
|
|
2372
|
+
|
|
2345
2373
|
*Secrets Management – Done Right. Encrypted, Cloaked, Secrets as Code.*
|
|
2346
2374
|
|
|
2347
2375
|
* <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
|