From 7670e8dbc02e08117d59bcd0c319f1614a82cc85 Mon Sep 17 00:00:00 2001 From: "W. Michael Petullo" Date: Tue, 2 Jan 2024 15:10:40 -0600 Subject: [PATCH] Add option to read version from environment Signed-off-by: W. Michael Petullo --- gophish.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gophish.go b/gophish.go index 67ccab16..087d3f57 100644 --- a/gophish.go +++ b/gophish.go @@ -59,12 +59,15 @@ var ( func main() { // Load the version - - version, err := ioutil.ReadFile("./VERSION") - if err != nil { - log.Fatal(err) + version := os.Getenv("GOPHISH_VERSION") + if version == "" { + versionBytes, err := ioutil.ReadFile("./VERSION") + if err != nil { + log.Fatal(err) + } + version = string(versionBytes) } - kingpin.Version(string(version)) + kingpin.Version(version) // Parse the CLI flags and load the config kingpin.CommandLine.HelpFlag.Short('h')