Skip to content

Commit 38fdd3f

Browse files
committed
fix(version): allow users to disable version check via environment variable
Signed-off-by: Nicklas Frahm <nicklas.frahm@gmail.com>
1 parent 222a7f7 commit 38fdd3f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmd/sops/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,8 +1517,9 @@ func main() {
15171517
Usage: "generate a new data encryption key and reencrypt all values with the new key",
15181518
},
15191519
cli.BoolFlag{
1520-
Name: "disable-version-check",
1521-
Usage: "do not check whether the current version is latest during --version",
1520+
Name: "disable-version-check",
1521+
Usage: "do not check whether the current version is latest during --version",
1522+
EnvVar: "SOPS_DISABLE_VERSION_CHECK",
15221523
},
15231524
cli.StringFlag{
15241525
Name: "kms, k",

version/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ import (
1515
var Version = "3.9.1"
1616

1717
// PrintVersion prints the current version of sops. If the flag
18-
// `--disable-version-check` is set, the function will not attempt
19-
// to retrieve the latest version from the GitHub API.
18+
// `--disable-version-check` is set or if the environment variable
19+
// SOPS_DISABLE_VERSION_CHECK is set to a value that is considered
20+
// true by https://pkg.go.dev/strconv#ParseBool, the function will
21+
// not attempt to retrieve the latest version from the GitHub API.
2022
//
2123
// If the flag is not set, the function will attempt to retrieve
2224
// the latest version from the GitHub API and compare it to the

0 commit comments

Comments
 (0)