changed the way oc-catalog API is constructed
This commit is contained in:
@@ -2,6 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
OCCatalog_cli "oc-search/api-client/oc-catalog"
|
||||
"oc-search/models"
|
||||
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
@@ -13,9 +14,10 @@ type MainController struct {
|
||||
|
||||
var OCCatalogAPI *OCCatalog_cli.APIClient
|
||||
|
||||
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://localhost:49618/v1",
|
||||
func CreateOCCatalogAPI() {
|
||||
config := models.GetConfig()
|
||||
// auth := context.WithValue(context.Background(), OCCatalog_cli.ContextAPIKey, OCCatalog_cli.APIKey{Key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJleHAiOjE2MTI1OTI3MDIsInVzZXJfaWQiOiJ4ZCJ9.kTLb1FtpdnaobUpe5u9Jw8S7Cc6gf7ExmU4U3XMcC2o"})
|
||||
OCCatalogAPI = OCCatalog_cli.NewAPIClient(&OCCatalog_cli.Configuration{BasePath: "http://"+config.OcCatalogUrl+"/v1",
|
||||
DefaultHeader: map[string]string{
|
||||
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJleHAiOjE2MTMwMDI0NjAsInVzZXJfaWQiOiJhc2QifQ.TXT18aeulnCrtedKKFVaD0BapOTdVAFcJJdVS7zk0I8",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user