detached a7a1150

Fix build version, set as variable in app for now

commit
a7a11508ee37b4f3ee1444f8e28235ea25c8e970
author
bnema · · 2023-09-22 16:57 UTC
parent
09af87f
signature
unsigned
1 file · +9 -10
M internal/app/app.go +9 -10
@@ -19,13 +19,6 @@ var (
1919 BuildVersion = "0.0.2"
2020 )
2121
22-func init() {
23- appEnv = os.Getenv("APP_ENV")
24- if appEnv == "" {
25- appEnv = "prod" // Default to "prod" if APP_ENV is not set
26- }
27-}
28-
2922 type App struct {
3023 TemplateFS fs.FS
3124 PublicFS fs.FS
@@ -76,9 +69,15 @@ func LoadConfig() (AppConfig, error) {
7669 var config AppConfig
7770 configDir, configFile := getConfigFile()
7871 fsys := os.DirFS(configDir)
79- BuildVersion = config.General.BuildVersion // Use directory path here
80- err := parser.OpenYamlFile(fsys, configFile, &config) // Assuming it doesn't need the last argument
81- return config, err
72+ err := parser.OpenYamlFile(fsys, configFile, &config)
73+ if err != nil {
74+ return config, err
75+ }
76+
77+ // Set the BuildVersion from the global BuildVersion
78+ config.General.BuildVersion = BuildVersion
79+
80+ return config, nil
8281 }
8382
8483 func NewApp() *App {
@@ -19,13 +19,6 @@ var (
19 BuildVersion = "0.0.2"19 BuildVersion = "0.0.2"
20 )20 )
21 21
22-func init() {
23- appEnv = os.Getenv("APP_ENV")
24- if appEnv == "" {
25- appEnv = "prod" // Default to "prod" if APP_ENV is not set
26- }
27-}
28-
29 type App struct {22 type App struct {
30 TemplateFS fs.FS23 TemplateFS fs.FS
31 PublicFS fs.FS24 PublicFS fs.FS
@@ -76,9 +69,15 @@ func LoadConfig() (AppConfig, error) {
76 var config AppConfig69 var config AppConfig
77 configDir, configFile := getConfigFile()70 configDir, configFile := getConfigFile()
78 fsys := os.DirFS(configDir)71 fsys := os.DirFS(configDir)
79- BuildVersion = config.General.BuildVersion // Use directory path here72+ err := parser.OpenYamlFile(fsys, configFile, &config)
80- err := parser.OpenYamlFile(fsys, configFile, &config) // Assuming it doesn't need the last argument73+ if err != nil {
81- return config, err74+ return config, err
75+ }
76+
77+ // Set the BuildVersion from the global BuildVersion
78+ config.General.BuildVersion = BuildVersion
79+
80+ return config, nil
82 }81 }
83 82
84 func NewApp() *App {83 func NewApp() *App {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close