Fix Goreleaser Build Bugs and Refactors
-Add 'dist/' to .gitignore -Refactor build version extraction in main.go -Move BuildVersion and RunEnv to BuildConfig -Remove debug print in oauth.go -Update session security settings based on HTTPS config -Modify scheme and domain logic in appserver.go -Update BuildVersion in html renderer
- commit
- 4e979c516ba4cfd09cc2269311d6a9d664966f48
- author
- bnema · · 2023-10-30 09:21 UTC
- parent
- 31c4687
- signature
- unsigned
8 files · +85 -26
M .gitignore +2 -1
| @@ -7,4 +7,5 @@ bun.lockb | |||
| 7 | 7 | *.log | |
| 8 | 8 | *.txt | |
| 9 | 9 | *sync-conflict* | |
| 10 | - | main⏎̸ | |
| 10 | + | main | |
| 11 | + | dist/ | |
| @@ -7,4 +7,5 @@ bun.lockb | |||||
| 7 | *.log | 7 | *.log | ||
| 8 | *.txt | 8 | *.txt | ||
| 9 | *sync-conflict* | 9 | *sync-conflict* | ||
| 10 | - | main⏎̸ | 10 | + | main |
| 11 | + | dist/ | |||
A .goreleaser.yaml +36 -0
| @@ -0,0 +1,36 @@ | |||
| 1 | + | before: | |
| 2 | + | hooks: | |
| 3 | + | # You may remove this if you don't use go modules. | |
| 4 | + | - go mod tidy | |
| 5 | + | ||
| 6 | + | builds: | |
| 7 | + | - id: "gordon" | |
| 8 | + | main: ./cmd/cli/main.go | |
| 9 | + | ldflags: | |
| 10 | + | - -s -w -X main.build={{.Version}} | |
| 11 | + | goos: | |
| 12 | + | - linux | |
| 13 | + | - windows | |
| 14 | + | - darwin | |
| 15 | + | ||
| 16 | + | archives: | |
| 17 | + | - format: tar.gz | |
| 18 | + | # this name template makes the OS and Arch compatible with the results of `uname`. | |
| 19 | + | name_template: >- | |
| 20 | + | {{ .ProjectName }}_ | |
| 21 | + | {{- title .Os }}_ | |
| 22 | + | {{- if eq .Arch "amd64" }}x86_64 | |
| 23 | + | {{- else if eq .Arch "386" }}i386 | |
| 24 | + | {{- else }}{{ .Arch }}{{ end }} | |
| 25 | + | {{- if .Arm }}v{{ .Arm }}{{ end }} | |
| 26 | + | # use zip for windows archives | |
| 27 | + | format_overrides: | |
| 28 | + | - goos: windows | |
| 29 | + | format: zip | |
| 30 | + | ||
| 31 | + | changelog: | |
| 32 | + | sort: asc | |
| 33 | + | filters: | |
| 34 | + | exclude: | |
| 35 | + | - "^docs:" | |
| 36 | + | - "^test:" | |
| @@ -0,0 +1,36 @@ | |||||
| 1 | + | before: | |||
| 2 | + | hooks: | |||
| 3 | + | # You may remove this if you don't use go modules. | |||
| 4 | + | - go mod tidy | |||
| 5 | + | ||||
| 6 | + | builds: | |||
| 7 | + | - id: "gordon" | |||
| 8 | + | main: ./cmd/cli/main.go | |||
| 9 | + | ldflags: | |||
| 10 | + | - -s -w -X main.build={{.Version}} | |||
| 11 | + | goos: | |||
| 12 | + | - linux | |||
| 13 | + | - windows | |||
| 14 | + | - darwin | |||
| 15 | + | ||||
| 16 | + | archives: | |||
| 17 | + | - format: tar.gz | |||
| 18 | + | # this name template makes the OS and Arch compatible with the results of `uname`. | |||
| 19 | + | name_template: >- | |||
| 20 | + | {{ .ProjectName }}_ | |||
| 21 | + | {{- title .Os }}_ | |||
| 22 | + | {{- if eq .Arch "amd64" }}x86_64 | |||
| 23 | + | {{- else if eq .Arch "386" }}i386 | |||
| 24 | + | {{- else }}{{ .Arch }}{{ end }} | |||
| 25 | + | {{- if .Arm }}v{{ .Arm }}{{ end }} | |||
| 26 | + | # use zip for windows archives | |||
| 27 | + | format_overrides: | |||
| 28 | + | - goos: windows | |||
| 29 | + | format: zip | |||
| 30 | + | ||||
| 31 | + | changelog: | |||
| 32 | + | sort: asc | |||
| 33 | + | filters: | |||
| 34 | + | exclude: | |||
| 35 | + | - "^docs:" | |||
| 36 | + | - "^test:" | |||
M cmd/cli/main.go +9 -0
| @@ -2,6 +2,7 @@ package main | |||
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | 4 | "fmt" | |
| 5 | + | "regexp" | |
| 5 | 6 | ||
| 6 | 7 | "github.com/bnema/gordon/internal/cli" | |
| 7 | 8 | "github.com/bnema/gordon/internal/cli/cmd" | |
| @@ -10,6 +11,8 @@ import ( | |||
| 10 | 11 | "github.com/spf13/cobra" | |
| 11 | 12 | ) | |
| 12 | 13 | ||
| 14 | + | var build string | |
| 15 | + | ||
| 13 | 16 | var rootCmd = &cobra.Command{Use: "gordon"} | |
| 14 | 17 | ||
| 15 | 18 | func InitializeCommands(a *cli.App, s *server.App) { | |
| @@ -35,5 +38,11 @@ func main() { | |||
| 35 | 38 | ||
| 36 | 39 | common.DockerInit(&s.Config.ContainerEngine) | |
| 37 | 40 | ||
| 41 | + | // build looks like this: "0.0.901-b98a337" | |
| 42 | + | //use regex to only get the version number | |
| 43 | + | build = regexp.MustCompile(`\d+\.\d+\.\d+`).FindString(build) | |
| 44 | + | // Set the BuildVersion | |
| 45 | + | s.Config.Build.BuildVersion = build | |
| 46 | + | ||
| 38 | 47 | Execute(a, s) | |
| 39 | 48 | } | |
| @@ -2,6 +2,7 @@ package main | |||||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | "fmt" | 4 | "fmt" | ||
| 5 | + | "regexp" | |||
| 5 | 6 | ||||
| 6 | "github.com/bnema/gordon/internal/cli" | 7 | "github.com/bnema/gordon/internal/cli" | ||
| 7 | "github.com/bnema/gordon/internal/cli/cmd" | 8 | "github.com/bnema/gordon/internal/cli/cmd" | ||
| @@ -10,6 +11,8 @@ import ( | |||||
| 10 | "github.com/spf13/cobra" | 11 | "github.com/spf13/cobra" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| 14 | + | var build string | |||
| 15 | + | ||||
| 13 | var rootCmd = &cobra.Command{Use: "gordon"} | 16 | var rootCmd = &cobra.Command{Use: "gordon"} | ||
| 14 | 17 | ||||
| 15 | func InitializeCommands(a *cli.App, s *server.App) { | 18 | func InitializeCommands(a *cli.App, s *server.App) { | ||
| @@ -35,5 +38,11 @@ func main() { | |||||
| 35 | 38 | ||||
| 36 | common.DockerInit(&s.Config.ContainerEngine) | 39 | common.DockerInit(&s.Config.ContainerEngine) | ||
| 37 | 40 | ||||
| 41 | + | // build looks like this: "0.0.901-b98a337" | |||
| 42 | + | //use regex to only get the version number | |||
| 43 | + | build = regexp.MustCompile(`\d+\.\d+\.\d+`).FindString(build) | |||
| 44 | + | // Set the BuildVersion | |||
| 45 | + | s.Config.Build.BuildVersion = build | |||
| 46 | + | ||||
| 38 | Execute(a, s) | 47 | Execute(a, s) | ||
| 39 | } | 48 | } | ||
M internal/common/initconfig.go +24 -12
| @@ -17,6 +17,12 @@ type Config struct { | |||
| 17 | 17 | Http HttpConfig `yaml:"Http"` | |
| 18 | 18 | Admin AdminConfig `yaml:"Admin"` | |
| 19 | 19 | ContainerEngine ContainerEngineConfig `yaml:"ContainerEngine"` | |
| 20 | + | Build BuildConfig `yaml:"-"` | |
| 21 | + | } | |
| 22 | + | ||
| 23 | + | type BuildConfig struct { | |
| 24 | + | RunEnv string `yaml:"-"` // come from env | |
| 25 | + | BuildVersion string `yaml:"-"` // come from build ldflags | |
| 20 | 26 | } | |
| 21 | 27 | ||
| 22 | 28 | type AdminConfig struct { | |
| @@ -24,16 +30,15 @@ type AdminConfig struct { | |||
| 24 | 30 | } | |
| 25 | 31 | ||
| 26 | 32 | type GeneralConfig struct { | |
| 27 | - | RunEnv string // come from env | |
| 28 | - | BuildVersion string // come from env | |
| 29 | - | StorageDir string `yaml:"storageDir"` | |
| 30 | - | Token string `yaml:"token"` | |
| 33 | + | StorageDir string `yaml:"storageDir"` | |
| 34 | + | Token string `yaml:"token"` | |
| 31 | 35 | } | |
| 32 | 36 | type HttpConfig struct { | |
| 33 | 37 | Port string `yaml:"port"` | |
| 34 | - | TopDomain string `yaml:"topDomain"` | |
| 38 | + | Domain string `yaml:"domain"` | |
| 35 | 39 | SubDomain string `yaml:"subDomain"` | |
| 36 | 40 | BackendURL string `yaml:"backendURL"` | |
| 41 | + | Https bool `yaml:"https"` | |
| 37 | 42 | } | |
| 38 | 43 | ||
| 39 | 44 | type ContainerEngineConfig struct { | |
| @@ -124,14 +129,11 @@ func (config *Config) LoadConfig() (*Config, error) { | |||
| 124 | 129 | return nil, err | |
| 125 | 130 | } | |
| 126 | 131 | ||
| 127 | - | // Load env elements | |
| 128 | - | config.General.BuildVersion = os.Getenv("BUILD_VERSION") | |
| 129 | - | config.General.RunEnv = os.Getenv("RUN_ENV") | |
| 132 | + | // Load run env | |
| 133 | + | config.Build.RunEnv = os.Getenv("RUN_ENV") | |
| 130 | 134 | ||
| 131 | - | // if RUN_ENV is not set, assume "prod" and config dir is the current dir | |
| 132 | - | if config.General.RunEnv == "" { | |
| 133 | - | config.General.RunEnv = "prod" | |
| 134 | - | configDir = "." | |
| 135 | + | if config.Build.RunEnv == "" { | |
| 136 | + | config.Build.RunEnv = "prod" | |
| 135 | 137 | } | |
| 136 | 138 | ||
| 137 | 139 | return config, nil | |
| @@ -162,3 +164,13 @@ func (config *Config) GetToken() (string, error) { | |||
| 162 | 164 | return token, nil | |
| 163 | 165 | ||
| 164 | 166 | } | |
| 167 | + | ||
| 168 | + | // GetBuildVersion returns the build version | |
| 169 | + | func (config *BuildConfig) GetBuildVersion() string { | |
| 170 | + | return config.BuildVersion | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | // GetRunEnv returns the run environment | |
| 174 | + | func (config *BuildConfig) GetRunEnv() string { | |
| 175 | + | return config.RunEnv | |
| 176 | + | } | |
| @@ -17,6 +17,12 @@ type Config struct { | |||||
| 17 | Http HttpConfig `yaml:"Http"` | 17 | Http HttpConfig `yaml:"Http"` | ||
| 18 | Admin AdminConfig `yaml:"Admin"` | 18 | Admin AdminConfig `yaml:"Admin"` | ||
| 19 | ContainerEngine ContainerEngineConfig `yaml:"ContainerEngine"` | 19 | ContainerEngine ContainerEngineConfig `yaml:"ContainerEngine"` | ||
| 20 | + | Build BuildConfig `yaml:"-"` | |||
| 21 | + | } | |||
| 22 | + | ||||
| 23 | + | type BuildConfig struct { | |||
| 24 | + | RunEnv string `yaml:"-"` // come from env | |||
| 25 | + | BuildVersion string `yaml:"-"` // come from build ldflags | |||
| 20 | } | 26 | } | ||
| 21 | 27 | ||||
| 22 | type AdminConfig struct { | 28 | type AdminConfig struct { | ||
| @@ -24,16 +30,15 @@ type AdminConfig struct { | |||||
| 24 | } | 30 | } | ||
| 25 | 31 | ||||
| 26 | type GeneralConfig struct { | 32 | type GeneralConfig struct { | ||
| 27 | - | RunEnv string // come from env | 33 | + | StorageDir string `yaml:"storageDir"` |
| 28 | - | BuildVersion string // come from env | 34 | + | Token string `yaml:"token"` |
| 29 | - | StorageDir string `yaml:"storageDir"` | |||
| 30 | - | Token string `yaml:"token"` | |||
| 31 | } | 35 | } | ||
| 32 | type HttpConfig struct { | 36 | type HttpConfig struct { | ||
| 33 | Port string `yaml:"port"` | 37 | Port string `yaml:"port"` | ||
| 34 | - | TopDomain string `yaml:"topDomain"` | 38 | + | Domain string `yaml:"domain"` |
| 35 | SubDomain string `yaml:"subDomain"` | 39 | SubDomain string `yaml:"subDomain"` | ||
| 36 | BackendURL string `yaml:"backendURL"` | 40 | BackendURL string `yaml:"backendURL"` | ||
| 41 | + | Https bool `yaml:"https"` | |||
| 37 | } | 42 | } | ||
| 38 | 43 | ||||
| 39 | type ContainerEngineConfig struct { | 44 | type ContainerEngineConfig struct { | ||
| @@ -124,14 +129,11 @@ func (config *Config) LoadConfig() (*Config, error) { | |||||
| 124 | return nil, err | 129 | return nil, err | ||
| 125 | } | 130 | } | ||
| 126 | 131 | ||||
| 127 | - | // Load env elements | 132 | + | // Load run env |
| 128 | - | config.General.BuildVersion = os.Getenv("BUILD_VERSION") | 133 | + | config.Build.RunEnv = os.Getenv("RUN_ENV") |
| 129 | - | config.General.RunEnv = os.Getenv("RUN_ENV") | |||
| 130 | 134 | ||||
| 131 | - | // if RUN_ENV is not set, assume "prod" and config dir is the current dir | 135 | + | if config.Build.RunEnv == "" { |
| 132 | - | if config.General.RunEnv == "" { | 136 | + | config.Build.RunEnv = "prod" |
| 133 | - | config.General.RunEnv = "prod" | |||
| 134 | - | configDir = "." | |||
| 135 | } | 137 | } | ||
| 136 | 138 | ||||
| 137 | return config, nil | 139 | return config, nil | ||
| @@ -162,3 +164,13 @@ func (config *Config) GetToken() (string, error) { | |||||
| 162 | return token, nil | 164 | return token, nil | ||
| 163 | 165 | ||||
| 164 | } | 166 | } | ||
| 167 | + | ||||
| 168 | + | // GetBuildVersion returns the build version | |||
| 169 | + | func (config *BuildConfig) GetBuildVersion() string { | |||
| 170 | + | return config.BuildVersion | |||
| 171 | + | } | |||
| 172 | + | ||||
| 173 | + | // GetRunEnv returns the run environment | |||
| 174 | + | func (config *BuildConfig) GetRunEnv() string { | |||
| 175 | + | return config.RunEnv | |||
| 176 | + | } | |||
M internal/httpserve/handler/oauth.go +0 -2
| @@ -219,8 +219,6 @@ func setSessionValues(c echo.Context, sess *sessions.Session, user *db.User, acc | |||
| 219 | 219 | sess.Values["expires"] = expires | |
| 220 | 220 | sess.Values["sessionID"] = sessionID | |
| 221 | 221 | ||
| 222 | - | fmt.Print(sess) | |
| 223 | - | ||
| 224 | 222 | if err := sess.Save(c.Request(), c.Response()); err != nil { | |
| 225 | 223 | return fmt.Errorf("could not save session: %w", err) | |
| 226 | 224 | } | |
| @@ -219,8 +219,6 @@ func setSessionValues(c echo.Context, sess *sessions.Session, user *db.User, acc | |||||
| 219 | sess.Values["expires"] = expires | 219 | sess.Values["expires"] = expires | ||
| 220 | sess.Values["sessionID"] = sessionID | 220 | sess.Values["sessionID"] = sessionID | ||
| 221 | 221 | ||||
| 222 | - | fmt.Print(sess) | |||
| 223 | - | ||||
| 224 | if err := sess.Save(c.Request(), c.Response()); err != nil { | 222 | if err := sess.Save(c.Request(), c.Response()); err != nil { | ||
| 225 | return fmt.Errorf("could not save session: %w", err) | 223 | return fmt.Errorf("could not save session: %w", err) | ||
| 226 | } | 224 | } | ||
M internal/httpserve/middleware/secure.go +2 -2
| @@ -25,7 +25,7 @@ func SecureRoutes() echo.MiddlewareFunc { | |||
| 25 | 25 | ||
| 26 | 26 | // InitSessionMiddleware initializes the session middleware with secure options | |
| 27 | 27 | func InitSessionMiddleware(a *server.App) echo.MiddlewareFunc { | |
| 28 | - | isDev := a.IsDevEnvironment() | |
| 28 | + | isHttps := a.Config.Http.Https | |
| 29 | 29 | secret := os.Getenv("SESSION_SECRET") | |
| 30 | 30 | if secret == "" { | |
| 31 | 31 | log.Fatal("Environment variable SESSION_SECRET is not set or cannot be read") | |
| @@ -34,7 +34,7 @@ func InitSessionMiddleware(a *server.App) echo.MiddlewareFunc { | |||
| 34 | 34 | store.Options = &sessions.Options{ | |
| 35 | 35 | Path: "/", | |
| 36 | 36 | HttpOnly: true, | |
| 37 | - | Secure: !isDev, // Set to true in production | |
| 37 | + | Secure: isHttps, | |
| 38 | 38 | MaxAge: 86400, | |
| 39 | 39 | } | |
| 40 | 40 | return func(next echo.HandlerFunc) echo.HandlerFunc { | |
| @@ -25,7 +25,7 @@ func SecureRoutes() echo.MiddlewareFunc { | |||||
| 25 | 25 | ||||
| 26 | // InitSessionMiddleware initializes the session middleware with secure options | 26 | // InitSessionMiddleware initializes the session middleware with secure options | ||
| 27 | func InitSessionMiddleware(a *server.App) echo.MiddlewareFunc { | 27 | func InitSessionMiddleware(a *server.App) echo.MiddlewareFunc { | ||
| 28 | - | isDev := a.IsDevEnvironment() | 28 | + | isHttps := a.Config.Http.Https |
| 29 | secret := os.Getenv("SESSION_SECRET") | 29 | secret := os.Getenv("SESSION_SECRET") | ||
| 30 | if secret == "" { | 30 | if secret == "" { | ||
| 31 | log.Fatal("Environment variable SESSION_SECRET is not set or cannot be read") | 31 | log.Fatal("Environment variable SESSION_SECRET is not set or cannot be read") | ||
| @@ -34,7 +34,7 @@ func InitSessionMiddleware(a *server.App) echo.MiddlewareFunc { | |||||
| 34 | store.Options = &sessions.Options{ | 34 | store.Options = &sessions.Options{ | ||
| 35 | Path: "/", | 35 | Path: "/", | ||
| 36 | HttpOnly: true, | 36 | HttpOnly: true, | ||
| 37 | - | Secure: !isDev, // Set to true in production | 37 | + | Secure: isHttps, |
| 38 | MaxAge: 86400, | 38 | MaxAge: 86400, | ||
| 39 | } | 39 | } | ||
| 40 | return func(next echo.HandlerFunc) echo.HandlerFunc { | 40 | return func(next echo.HandlerFunc) echo.HandlerFunc { | ||
M internal/server/appserver.go +11 -8
| @@ -36,24 +36,27 @@ type DBTables struct { | |||
| 36 | 36 | func (a *App) GenerateOauthCallbackURL() string { | |
| 37 | 37 | var scheme, port string | |
| 38 | 38 | config := a.Config | |
| 39 | - | if config.General.RunEnv == "dev" { | |
| 40 | - | scheme = "http" | |
| 41 | - | port = ":" + config.Http.Port | |
| 42 | - | } else { // Assuming "prod" | |
| 39 | + | ||
| 40 | + | if config.Http.Https { | |
| 43 | 41 | scheme = "https" | |
| 44 | 42 | port = "" | |
| 45 | 43 | } | |
| 46 | 44 | ||
| 47 | - | domain := config.Http.TopDomain | |
| 45 | + | if !config.Http.Https { | |
| 46 | + | scheme = "http" | |
| 47 | + | port = fmt.Sprintf(":%s", a.Config.Http.Port) | |
| 48 | + | } | |
| 49 | + | ||
| 50 | + | domain := config.Http.Domain | |
| 48 | 51 | if config.Http.SubDomain != "" { | |
| 49 | - | domain = fmt.Sprintf("%s.%s", config.Http.SubDomain, config.Http.TopDomain) | |
| 52 | + | domain = fmt.Sprintf("%s.%s", config.Http.SubDomain, config.Http.Domain) | |
| 50 | 53 | } | |
| 51 | 54 | ||
| 52 | 55 | return fmt.Sprintf("%s://%s%s%s/login/oauth/callback", scheme, domain, port, config.Admin.Path) | |
| 53 | 56 | } | |
| 54 | 57 | ||
| 55 | 58 | func (a *App) IsDevEnvironment() bool { | |
| 56 | - | return a.Config.General.RunEnv == "dev" | |
| 59 | + | return a.Config.Build.RunEnv == "dev" | |
| 57 | 60 | } | |
| 58 | 61 | ||
| 59 | 62 | func (a *App) GetUptime() string { | |
| @@ -63,5 +66,5 @@ func (a *App) GetUptime() string { | |||
| 63 | 66 | ||
| 64 | 67 | // GetVersion returns the version of the app | |
| 65 | 68 | func (a *App) GetVersionstring() string { | |
| 66 | - | return fmt.Sprint(a.Config.General.BuildVersion) | |
| 69 | + | return fmt.Sprint(a.Config.Build.BuildVersion) | |
| 67 | 70 | } | |
| @@ -36,24 +36,27 @@ type DBTables struct { | |||||
| 36 | func (a *App) GenerateOauthCallbackURL() string { | 36 | func (a *App) GenerateOauthCallbackURL() string { | ||
| 37 | var scheme, port string | 37 | var scheme, port string | ||
| 38 | config := a.Config | 38 | config := a.Config | ||
| 39 | - | if config.General.RunEnv == "dev" { | 39 | + | |
| 40 | - | scheme = "http" | 40 | + | if config.Http.Https { |
| 41 | - | port = ":" + config.Http.Port | |||
| 42 | - | } else { // Assuming "prod" | |||
| 43 | scheme = "https" | 41 | scheme = "https" | ||
| 44 | port = "" | 42 | port = "" | ||
| 45 | } | 43 | } | ||
| 46 | 44 | ||||
| 47 | - | domain := config.Http.TopDomain | 45 | + | if !config.Http.Https { |
| 46 | + | scheme = "http" | |||
| 47 | + | port = fmt.Sprintf(":%s", a.Config.Http.Port) | |||
| 48 | + | } | |||
| 49 | + | ||||
| 50 | + | domain := config.Http.Domain | |||
| 48 | if config.Http.SubDomain != "" { | 51 | if config.Http.SubDomain != "" { | ||
| 49 | - | domain = fmt.Sprintf("%s.%s", config.Http.SubDomain, config.Http.TopDomain) | 52 | + | domain = fmt.Sprintf("%s.%s", config.Http.SubDomain, config.Http.Domain) |
| 50 | } | 53 | } | ||
| 51 | 54 | ||||
| 52 | return fmt.Sprintf("%s://%s%s%s/login/oauth/callback", scheme, domain, port, config.Admin.Path) | 55 | return fmt.Sprintf("%s://%s%s%s/login/oauth/callback", scheme, domain, port, config.Admin.Path) | ||
| 53 | } | 56 | } | ||
| 54 | 57 | ||||
| 55 | func (a *App) IsDevEnvironment() bool { | 58 | func (a *App) IsDevEnvironment() bool { | ||
| 56 | - | return a.Config.General.RunEnv == "dev" | 59 | + | return a.Config.Build.RunEnv == "dev" |
| 57 | } | 60 | } | ||
| 58 | 61 | ||||
| 59 | func (a *App) GetUptime() string { | 62 | func (a *App) GetUptime() string { | ||
| @@ -63,5 +66,5 @@ func (a *App) GetUptime() string { | |||||
| 63 | 66 | ||||
| 64 | // GetVersion returns the version of the app | 67 | // GetVersion returns the version of the app | ||
| 65 | func (a *App) GetVersionstring() string { | 68 | func (a *App) GetVersionstring() string { | ||
| 66 | - | return fmt.Sprint(a.Config.General.BuildVersion) | 69 | + | return fmt.Sprint(a.Config.Build.BuildVersion) |
| 67 | } | 70 | } | ||
M internal/templating/render/html.go +1 -1
| @@ -71,6 +71,6 @@ func GetHTMLRenderer(mainPath string, filename string, fs fs.FS, a *server.App, | |||
| 71 | 71 | // Return the Renderer instance | |
| 72 | 72 | return &Renderer{ | |
| 73 | 73 | Template: tmpl, | |
| 74 | - | BuildVersion: a.Config.General.BuildVersion, | |
| 74 | + | BuildVersion: a.Config.Build.BuildVersion, | |
| 75 | 75 | }, nil | |
| 76 | 76 | } | |
| @@ -71,6 +71,6 @@ func GetHTMLRenderer(mainPath string, filename string, fs fs.FS, a *server.App, | |||||
| 71 | // Return the Renderer instance | 71 | // Return the Renderer instance | ||
| 72 | return &Renderer{ | 72 | return &Renderer{ | ||
| 73 | Template: tmpl, | 73 | Template: tmpl, | ||
| 74 | - | BuildVersion: a.Config.General.BuildVersion, | 74 | + | BuildVersion: a.Config.Build.BuildVersion, |
| 75 | }, nil | 75 | }, nil | ||
| 76 | } | 76 | } | ||