summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--forgeConfig.proto2
-rw-r--r--http.go8
-rw-r--r--init.go14
-rw-r--r--structs.go4
4 files changed, 16 insertions, 12 deletions
diff --git a/forgeConfig.proto b/forgeConfig.proto
index a46e3a3..a002214 100644
--- a/forgeConfig.proto
+++ b/forgeConfig.proto
@@ -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
}
diff --git a/http.go b/http.go
index e542c39..5ebe55f 100644
--- a/http.go
+++ b/http.go
@@ -17,8 +17,8 @@ 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")
- finalURL := baseURL.JoinPath(route) // Correctly produces ...:2520/patches
+ baseURL, _ := url.Parse(f.Config.ForgeURL) // "http://forge.grid.wit.com:2520")
+ finalURL := baseURL.JoinPath(route) // Correctly produces ...:2520/patches
var err error
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) {
- 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.
diff --git a/init.go b/init.go
index c5b8264..ca5db21 100644
--- a/init.go
+++ b/init.go
@@ -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" {
diff --git a/structs.go b/structs.go
index 07c4af0..3c636d9 100644
--- a/structs.go
+++ b/structs.go
@@ -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
}