keep removing non-protobuf fields

This commit is contained in:
Jeff Carr 2025-09-11 21:19:54 -05:00
parent 81cac13284
commit 235fe57beb
4 changed files with 16 additions and 12 deletions

View File

@ -60,7 +60,7 @@ message ForgeConfigs { // `autogenpb:mar
string ReposPB = 11; // where the repos.pb is
string ReposDir = 12; // where the repos are
string PatchDir = 13; // patch dir
string ForgURL = 14; // forge URL
string ForgeURL = 14; // forge URL
string Filename = 15; // filename of the config file
}

View File

@ -17,7 +17,7 @@ import (
func (f *Forge) HttpPost(base string, route string, data []byte) ([]byte, error) {
// Fix using url.JoinPath (Best Practice)
baseURL, _ := url.Parse(f.forgeURL) // "http://forge.grid.wit.com:2520")
baseURL, _ := url.Parse(f.Config.ForgeURL) // "http://forge.grid.wit.com:2520")
finalURL := baseURL.JoinPath(route) // Correctly produces ...:2520/patches
var err error
@ -52,7 +52,7 @@ func rawHttpPost(req *http.Request) ([]byte, error) {
}
func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
url := f.forgeURL + "lookup"
url := f.Config.ForgeURL + "lookup"
for repo := range check.IterByFullPath() {
if repo.Namespace == "" {
@ -63,6 +63,7 @@ func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
return check.SubmitReposPB(url)
}
/*
func (f *Forge) LookupPB(check *gitpb.Repos) (*gitpb.Repos, error) {
url := f.forgeURL + "lookup"
@ -102,6 +103,7 @@ func (f *Forge) UpdatePB(check *gitpb.Repos) (*gitpb.Repos, error) {
return queryPB.SubmitReposPB(url)
}
*/
/*
// HTTPRequestToProto converts an *http.Request to our custom HttpRequest protobuf message.

14
init.go
View File

@ -144,7 +144,7 @@ func (f *Forge) setenv() {
}
// f.configDir = os.Getenv("FORGE_CONFIG")
f.goSrc = os.Getenv("FORGE_GOSRC")
f.forgeURL = os.Getenv("FORGE_URL")
// f.forgeURL = os.Getenv("FORGE_URL")
f.hostname = os.Getenv("HOSTNAME")
if os.Getenv("FORGE_GOWORK") == "true" {
f.goWork = true
@ -152,6 +152,7 @@ func (f *Forge) setenv() {
f.Config.ReposPB = os.Getenv("FORGE_REPOPB")
f.Config.PatchDir = os.Getenv("FORGE_PATCHDIR")
f.Config.ForgeURL = os.Getenv("FORGE_URL")
})
}
@ -181,7 +182,7 @@ func checkenv() bool {
*/
func (f *Forge) GetForgeURL() string {
return f.forgeURL
return f.Config.ForgeURL
}
// set the URL for forge otherwise fallback to ENV or to forge.wit.com
@ -192,9 +193,9 @@ func (f *Forge) SetForgeURL(url string) {
if url == "" {
url = "https://forge.wit.com/"
}
f.forgeURL = url
os.Setenv("FORGE_URL", f.forgeURL)
log.Info("Forge URL has been set to", f.forgeURL)
f.Config.ForgeURL = url
os.Setenv("FORGE_URL", f.Config.ForgeURL)
log.Info("Forge URL has been set to", f.Config.ForgeURL)
}
// the first thing done is process any ENV settings
@ -227,7 +228,8 @@ func (f *Forge) configENV() bool {
// f.configDir = os.Getenv("FORGE_CONFIG")
f.goSrc = os.Getenv("FORGE_GOSRC")
f.forgeURL = os.Getenv("FORGE_URL")
// f.forgeURL = os.Getenv("FORGE_URL")
f.Config.ForgeURL = os.Getenv("FORGE_URL")
// f.patchDir = os.Getenv("FORGE_PATCHDIR")
f.hostname = os.Getenv("HOSTNAME")
if os.Getenv("FORGE_GOWORK") == "true" {

View File

@ -12,7 +12,6 @@ type Forge struct {
// one-time initialized data
once sync.Once
initErr error // init error, if any
goSrc string // the path to go/src
goWork bool // means the user is currently using a go.work file
Config *ForgeConfigs // config repos for readonly, private, etc
Repos *gitpb.Repos // the repo protobufs
@ -20,10 +19,11 @@ type Forge struct {
hasFullScan bool // track last scan so it can be throttled
fullscan time.Time // time of the last scan so it can be throttled
hostname string // your hostname
forgeURL string // URL to use to forge.wit.com
rillX int // used for Rill()
rillY int // used for Rill()
Patchsets *Patchsets // patches that are in progress
goSrc string // the path to go/src
// forgeURL string // URL to use to forge.wit.com
// configDir string // normally ~/.config/forge
// patchDir string // where patches are stored
}