Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iwangjintian committed May 14, 2024
1 parent e733868 commit 0b9391e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
5 changes: 4 additions & 1 deletion api/pkg/apis/v1alpha1/managers/sites/sites-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ func (s *SitesManager) Init(context *contexts.VendorContext, config managers.Man
} else {
return err
}
s.apiClient, err = utils.GetUPApiClient(s.VendorContext.SiteInfo.ParentSite.BaseUrl)
s.apiClient, err = utils.GetParentApiClient(s.VendorContext.SiteInfo.ParentSite.BaseUrl)
if err != nil {
return err
}
return nil
}

Expand Down
5 changes: 4 additions & 1 deletion api/pkg/apis/v1alpha1/managers/solution/solution-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ func (s *SolutionManager) Init(context *contexts.VendorContext, config managers.
return err
}
}
s.ApiClientHttp, err = api_utils.GetUPApiClient(s.Context.SiteInfo.ParentSite.BaseUrl)
s.ApiClientHttp, err = api_utils.GetParentApiClient(s.Context.SiteInfo.ParentSite.BaseUrl)
if err != nil {
return err
}
return nil
}

Expand Down
5 changes: 4 additions & 1 deletion api/pkg/apis/v1alpha1/managers/sync/sync-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func (s *SyncManager) Init(context *contexts.VendorContext, config managers.Mana
if s.Context.SiteInfo.SiteId == "" {
return v1alpha2.NewCOAError(nil, "siteId is required", v1alpha2.BadConfig)
}
s.apiClient, err = utils.GetUPApiClient(s.VendorContext.SiteInfo.ParentSite.BaseUrl)
s.apiClient, err = utils.GetParentApiClient(s.VendorContext.SiteInfo.ParentSite.BaseUrl)
if err != nil {
return err
}
return nil
}
func (s *SyncManager) Enabled() bool {
Expand Down
2 changes: 1 addition & 1 deletion api/pkg/apis/v1alpha1/utils/symphony-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func getApiClient() (*apiClient, error) {
return client, nil
}

func GetUPApiClient(baseUrl string) (*apiClient, error) {
func GetParentApiClient(baseUrl string) (*apiClient, error) {
clientOptions := make([]ApiClientOption, 0)

if caCert, ok := os.LookupEnv(constants.ApiCertEnvName); ok {
Expand Down
6 changes: 4 additions & 2 deletions api/pkg/apis/v1alpha1/vendors/federation-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ func (f *FederationVendor) Init(config vendors.VendorConfig, factories []manager
if f.CatalogsManager == nil {
return v1alpha2.NewCOAError(nil, "catalogs manager is not supplied", v1alpha2.MissingConfig)
}
f.apiClient, err = utils.GetUPApiClient(f.Vendor.Context.SiteInfo.ParentSite.BaseUrl)

f.apiClient, err = utils.GetParentApiClient(f.Vendor.Context.SiteInfo.ParentSite.BaseUrl)
if err != nil {
return err
}
f.Vendor.Context.Subscribe("catalog", func(topic string, event v1alpha2.Event) error {
sites, err := f.SitesManager.ListState(context.TODO())
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions coa/pkg/apis/v1alpha2/bindings/http/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ func decodeJWTTokenForIssuer(tokenString string) (string, error) {
if claims, ok := token.Claims.(jwt.MapClaims); ok {
issuer, ok := claims["iss"].(string)
if !ok {
fmt.Println("The iss claim is not a string")
log.Debugf("The iss claim is not a string")
return "", errors.New("the iss claim is not a string")
}
fmt.Println("Issuer:", issuer)
log.Debugf("Issuer: %s", issuer)
return issuer, nil
} else {
fmt.Println("Invalid token")
log.Debugf("Invalid token")
return "", errors.New("invalid token")
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/helm/symphony/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ redis:
image: redis/redis-stack-server:latest
port: 6379
parent:
url: http://57.151.43.118:8080/v1alpha2/
url:
username: admin
password:
siteId: jesseminikube
siteId: hq
imagePrivateRegistryUrl: ghcr.io
api:
apiContainerPortHttp: 8080
Expand Down

0 comments on commit 0b9391e

Please sign in to comment.