gw repos: use config provided gitServerURL
This commit is contained in:
parent
ac28731d11
commit
fe5bc2fa31
@ -3,6 +3,8 @@ gateway:
|
|||||||
webExposedURL: "http://172.17.0.1:8080"
|
webExposedURL: "http://172.17.0.1:8080"
|
||||||
runServiceURL: "http://localhost:4000"
|
runServiceURL: "http://localhost:4000"
|
||||||
configStoreURL: "http://localhost:4002"
|
configStoreURL: "http://localhost:4002"
|
||||||
|
gitServerURL: "http://172.17.0.1:4003"
|
||||||
|
|
||||||
web:
|
web:
|
||||||
listenAddress: ":8000"
|
listenAddress: ":8000"
|
||||||
tokenSigning:
|
tokenSigning:
|
||||||
|
@ -43,6 +43,7 @@ type Gateway struct {
|
|||||||
|
|
||||||
RunServiceURL string `yaml:"runServiceURL"`
|
RunServiceURL string `yaml:"runServiceURL"`
|
||||||
ConfigStoreURL string `yaml:"configStoreURL"`
|
ConfigStoreURL string `yaml:"configStoreURL"`
|
||||||
|
GitServerURL string `yaml:"gitServerURL"`
|
||||||
|
|
||||||
Web Web `yaml:"web"`
|
Web Web `yaml:"web"`
|
||||||
Etcd Etcd `yaml:"etcd"`
|
Etcd Etcd `yaml:"etcd"`
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
csapi "github.com/sorintlab/agola/internal/services/configstore/api"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
@ -27,11 +26,11 @@ import (
|
|||||||
|
|
||||||
type ReposHandler struct {
|
type ReposHandler struct {
|
||||||
log *zap.SugaredLogger
|
log *zap.SugaredLogger
|
||||||
configstoreClient *csapi.Client
|
gitServerURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewReposHandler(logger *zap.Logger, configstoreClient *csapi.Client) *ReposHandler {
|
func NewReposHandler(logger *zap.Logger, gitServerURL string) *ReposHandler {
|
||||||
return &ReposHandler{log: logger.Sugar(), configstoreClient: configstoreClient}
|
return &ReposHandler{log: logger.Sugar(), gitServerURL: gitServerURL}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *ReposHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *ReposHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -41,7 +40,7 @@ func (h *ReposHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
h.log.Infof("path: %s", path)
|
h.log.Infof("path: %s", path)
|
||||||
|
|
||||||
u, err := url.Parse("http://172.17.0.1:4003")
|
u, err := url.Parse(h.gitServerURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
@ -194,7 +194,7 @@ func (g *Gateway) Run(ctx context.Context) error {
|
|||||||
|
|
||||||
logsHandler := api.NewLogsHandler(logger, g.runserviceClient)
|
logsHandler := api.NewLogsHandler(logger, g.runserviceClient)
|
||||||
|
|
||||||
reposHandler := api.NewReposHandler(logger, g.configstoreClient)
|
reposHandler := api.NewReposHandler(logger, g.c.GitServerURL)
|
||||||
|
|
||||||
loginUserHandler := api.NewLoginUserHandler(logger, g.ch)
|
loginUserHandler := api.NewLoginUserHandler(logger, g.ch)
|
||||||
authorizeHandler := api.NewAuthorizeHandler(logger, g.ch)
|
authorizeHandler := api.NewAuthorizeHandler(logger, g.ch)
|
||||||
|
Loading…
Reference in New Issue
Block a user