diff options
author | 2021-06-28 12:17:20 +0200 | |
---|---|---|
committer | 2021-06-28 12:17:20 +0200 | |
commit | 4f3b3f5c0b00b8c47c7e7d8e6c2dda624e114cde (patch) | |
tree | af7583b906543148fcd00c2e4e3bf0525f03be18 /cmd | |
parent | Remote instance dereferencing (#70) (diff) | |
download | gotosocial-4f3b3f5c0b00b8c47c7e7d8e6c2dda624e114cde.tar.xz |
put version in binary properly (#73)
Addresses #71 :
Set version on the CLI framework.
Add a build.sh script that injects variables into the build tooling using git and a version file.
Set version in config.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gotosocial/main.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd/gotosocial/main.go b/cmd/gotosocial/main.go index 27810a80b..9729f7706 100644 --- a/cmd/gotosocial/main.go +++ b/cmd/gotosocial/main.go @@ -33,12 +33,19 @@ import ( "github.com/urfave/cli/v2" ) +// Version is the software version of GtS being used +var Version string + +// Commit is the git commit of GtS being used +var Commit string + func main() { flagNames := config.GetFlagNames() envNames := config.GetEnvNames() defaults := config.GetDefaults() app := &cli.App{ - Usage: "a fediverse social media server", + Version: Version + " " + Commit[:7], + Usage: "a fediverse social media server", Flags: []cli.Flag{ // GENERAL FLAGS &cli.StringFlag{ @@ -399,7 +406,7 @@ func runAction(c *cli.Context, a cliactions.GTSAction) error { return fmt.Errorf("error creating config: %s", err) } // ... and the flags set on the *cli.Context by urfave - if err := conf.ParseCLIFlags(c); err != nil { + if err := conf.ParseCLIFlags(c, c.App.Version); err != nil { return fmt.Errorf("error parsing config: %s", err) } |