34 lines
880 B
Diff
34 lines
880 B
Diff
From 7670e8dbc02e08117d59bcd0c319f1614a82cc85 Mon Sep 17 00:00:00 2001
|
|
From: "W. Michael Petullo" <mike@flyn.org>
|
|
Date: Tue, 2 Jan 2024 15:10:40 -0600
|
|
Subject: [PATCH] Add option to read version from environment
|
|
|
|
Signed-off-by: W. Michael Petullo <mike@flyn.org>
|
|
---
|
|
gophish.go | 13 ++++++++-----
|
|
1 file changed, 8 insertions(+), 5 deletions(-)
|
|
|
|
--- 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')
|