Skip to content

Commit

Permalink
fix(version): allow users to disable version check via environment va…
Browse files Browse the repository at this point in the history
…riable

Signed-off-by: Nicklas Frahm <[email protected]>
  • Loading branch information
nicklasfrahm committed Dec 1, 2024
1 parent 4bc6aa6 commit 3436b03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,9 @@ func main() {
Usage: "generate a new data encryption key and reencrypt all values with the new key",
},
cli.BoolFlag{
Name: "disable-version-check",
Usage: "do not check whether the current version is latest during --version",
Name: "disable-version-check",
Usage: "do not check whether the current version is latest during --version",
EnvVar: "SOPS_DISABLE_VERSION_CHECK",
},
cli.StringFlag{
Name: "kms, k",
Expand Down
6 changes: 4 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import (
var Version = "3.9.1"

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

0 comments on commit 3436b03

Please sign in to comment.