configuration done in conf/conf.go init()
This commit is contained in:
@@ -2,6 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
OCCatalog_cli "oc-search/api-client/oc-catalog"
|
||||
conf "oc-search/conf"
|
||||
|
||||
"github.com/beego/beego/logs"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
@@ -14,6 +15,11 @@ type MainController struct {
|
||||
|
||||
var OCCatalogAPI *OCCatalog_cli.APIClient
|
||||
|
||||
// This method should not be called init() because it will
|
||||
// lead to the parameter BasePath to not be able to
|
||||
// retrieve its value from a config file, that will
|
||||
// be read after the init has happened (at import of the package)
|
||||
|
||||
func init() {
|
||||
|
||||
// OcCatalogURL := conf.GetConfig().OcCatalogUrl
|
||||
@@ -22,7 +28,7 @@ func init() {
|
||||
// }
|
||||
|
||||
// auth := context.WithValue(context.Background(), OCCatalog_cli.ContextAPIKey, OCCatalog_cli.APIKey{Key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJleHAiOjE2MTI1OTI3MDIsInVzZXJfaWQiOiJ4ZCJ9.kTLb1FtpdnaobUpe5u9Jw8S7Cc6gf7ExmU4U3XMcC2o"})
|
||||
OCCatalogAPI = OCCatalog_cli.NewAPIClient(&OCCatalog_cli.Configuration{BasePath: "http://"+ "oc-catalog:8080" +"/v1",
|
||||
OCCatalogAPI = OCCatalog_cli.NewAPIClient(&OCCatalog_cli.Configuration{BasePath: "http://"+ conf.GetConfig().OcCatalogUrl +"/v1",
|
||||
DefaultHeader: map[string]string{
|
||||
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJleHAiOjE2MTMwMDI0NjAsInVzZXJfaWQiOiJhc2QifQ.TXT18aeulnCrtedKKFVaD0BapOTdVAFcJJdVS7zk0I8",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user