This commit is contained in:
Jeff Carr 2025-09-11 23:10:26 -05:00
parent 7a76b5acd1
commit 2b6107fa51
1 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@ package main
import ( import (
"errors" "errors"
"os" "os"
"path/filepath"
"go.wit.com/lib/config" "go.wit.com/lib/config"
"go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/forgepb"
@ -22,8 +23,8 @@ func configInit() *forgepb.ForgeConfigs {
} }
// the default forged dir is /home/forge // the default forged dir is /home/forge
if os.Getenv("FORGE_GOSRC") == "" { if os.Getenv("FORGE_REPODIR") == "" {
os.Setenv("FORGE_GOSRC", "/home/forge") os.Setenv("FORGE_REPODIR", "/home/forge")
} }
if os.Getenv("FORGE_PATCHDIR") == "" { if os.Getenv("FORGE_PATCHDIR") == "" {
@ -33,9 +34,9 @@ func configInit() *forgepb.ForgeConfigs {
configs := new(forgepb.ForgeConfigs) configs := new(forgepb.ForgeConfigs)
err := config.ConfigLoad(configs, ARGNAME, "forge") err := config.ConfigLoad(configs, ARGNAME, "forge")
if errors.Is(err, os.ErrNotExist) { if errors.Is(err, os.ErrNotExist) {
configs.ReposDir = "/home/forge" configs.ReposDir = os.Getenv("FORGE_REPODIR")
configs.ReposPB = "/home/forge/repos.pb" configs.ReposPB = filepath.Join(configs.ReposDir, "repos.pb")
configs.PatchDir = "/var/lib/forged" configs.PatchDir = os.Getenv("FORGE_PATCHDIR")
if err := configSave(); err != nil { if err := configSave(); err != nil {
badExit(err) badExit(err)
} }