keep removing non-protobuf fields
This commit is contained in:
parent
81cac13284
commit
235fe57beb
|
@ -60,7 +60,7 @@ message ForgeConfigs { // `autogenpb:mar
|
||||||
string ReposPB = 11; // where the repos.pb is
|
string ReposPB = 11; // where the repos.pb is
|
||||||
string ReposDir = 12; // where the repos are
|
string ReposDir = 12; // where the repos are
|
||||||
string PatchDir = 13; // patch dir
|
string PatchDir = 13; // patch dir
|
||||||
string ForgURL = 14; // forge URL
|
string ForgeURL = 14; // forge URL
|
||||||
string Filename = 15; // filename of the config file
|
string Filename = 15; // filename of the config file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
http.go
8
http.go
|
@ -17,8 +17,8 @@ import (
|
||||||
|
|
||||||
func (f *Forge) HttpPost(base string, route string, data []byte) ([]byte, error) {
|
func (f *Forge) HttpPost(base string, route string, data []byte) ([]byte, error) {
|
||||||
// Fix using url.JoinPath (Best Practice)
|
// 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
|
finalURL := baseURL.JoinPath(route) // Correctly produces ...:2520/patches
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var req *http.Request
|
var req *http.Request
|
||||||
|
@ -52,7 +52,7 @@ func rawHttpPost(req *http.Request) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, 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() {
|
for repo := range check.IterByFullPath() {
|
||||||
if repo.Namespace == "" {
|
if repo.Namespace == "" {
|
||||||
|
@ -63,6 +63,7 @@ func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
return check.SubmitReposPB(url)
|
return check.SubmitReposPB(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (f *Forge) LookupPB(check *gitpb.Repos) (*gitpb.Repos, error) {
|
func (f *Forge) LookupPB(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
url := f.forgeURL + "lookup"
|
url := f.forgeURL + "lookup"
|
||||||
|
|
||||||
|
@ -102,6 +103,7 @@ func (f *Forge) UpdatePB(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
|
|
||||||
return queryPB.SubmitReposPB(url)
|
return queryPB.SubmitReposPB(url)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// HTTPRequestToProto converts an *http.Request to our custom HttpRequest protobuf message.
|
// HTTPRequestToProto converts an *http.Request to our custom HttpRequest protobuf message.
|
||||||
|
|
14
init.go
14
init.go
|
@ -144,7 +144,7 @@ func (f *Forge) setenv() {
|
||||||
}
|
}
|
||||||
// f.configDir = os.Getenv("FORGE_CONFIG")
|
// f.configDir = os.Getenv("FORGE_CONFIG")
|
||||||
f.goSrc = os.Getenv("FORGE_GOSRC")
|
f.goSrc = os.Getenv("FORGE_GOSRC")
|
||||||
f.forgeURL = os.Getenv("FORGE_URL")
|
// f.forgeURL = os.Getenv("FORGE_URL")
|
||||||
f.hostname = os.Getenv("HOSTNAME")
|
f.hostname = os.Getenv("HOSTNAME")
|
||||||
if os.Getenv("FORGE_GOWORK") == "true" {
|
if os.Getenv("FORGE_GOWORK") == "true" {
|
||||||
f.goWork = true
|
f.goWork = true
|
||||||
|
@ -152,6 +152,7 @@ func (f *Forge) setenv() {
|
||||||
|
|
||||||
f.Config.ReposPB = os.Getenv("FORGE_REPOPB")
|
f.Config.ReposPB = os.Getenv("FORGE_REPOPB")
|
||||||
f.Config.PatchDir = os.Getenv("FORGE_PATCHDIR")
|
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 {
|
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
|
// 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 == "" {
|
if url == "" {
|
||||||
url = "https://forge.wit.com/"
|
url = "https://forge.wit.com/"
|
||||||
}
|
}
|
||||||
f.forgeURL = url
|
f.Config.ForgeURL = url
|
||||||
os.Setenv("FORGE_URL", f.forgeURL)
|
os.Setenv("FORGE_URL", f.Config.ForgeURL)
|
||||||
log.Info("Forge URL has been set to", f.forgeURL)
|
log.Info("Forge URL has been set to", f.Config.ForgeURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
// the first thing done is process any ENV settings
|
// 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.configDir = os.Getenv("FORGE_CONFIG")
|
||||||
f.goSrc = os.Getenv("FORGE_GOSRC")
|
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.patchDir = os.Getenv("FORGE_PATCHDIR")
|
||||||
f.hostname = os.Getenv("HOSTNAME")
|
f.hostname = os.Getenv("HOSTNAME")
|
||||||
if os.Getenv("FORGE_GOWORK") == "true" {
|
if os.Getenv("FORGE_GOWORK") == "true" {
|
||||||
|
|
|
@ -12,7 +12,6 @@ type Forge struct {
|
||||||
// one-time initialized data
|
// one-time initialized data
|
||||||
once sync.Once
|
once sync.Once
|
||||||
initErr error // init error, if any
|
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
|
goWork bool // means the user is currently using a go.work file
|
||||||
Config *ForgeConfigs // config repos for readonly, private, etc
|
Config *ForgeConfigs // config repos for readonly, private, etc
|
||||||
Repos *gitpb.Repos // the repo protobufs
|
Repos *gitpb.Repos // the repo protobufs
|
||||||
|
@ -20,10 +19,11 @@ type Forge struct {
|
||||||
hasFullScan bool // track last scan so it can be throttled
|
hasFullScan bool // track last scan so it can be throttled
|
||||||
fullscan time.Time // time of the last scan so it can be throttled
|
fullscan time.Time // time of the last scan so it can be throttled
|
||||||
hostname string // your hostname
|
hostname string // your hostname
|
||||||
forgeURL string // URL to use to forge.wit.com
|
|
||||||
rillX int // used for Rill()
|
rillX int // used for Rill()
|
||||||
rillY int // used for Rill()
|
rillY int // used for Rill()
|
||||||
Patchsets *Patchsets // patches that are in progress
|
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
|
// configDir string // normally ~/.config/forge
|
||||||
// patchDir string // where patches are stored
|
// patchDir string // where patches are stored
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue