Skip to content

Commit

Permalink
feat: 添加私有化版本参数
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambition9186 committed Jun 28, 2024
1 parent 68bf296 commit 5fb78f9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
17 changes: 10 additions & 7 deletions bcs-services/bcs-bscp/pkg/cc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ type Setting interface {

// ApiServerSetting defines api server used setting options.
type ApiServerSetting struct {
Network Network `yaml:"network"`
Service Service `yaml:"service"`
Log LogOption `yaml:"log"`
Repo Repository `yaml:"repository"`
BKNotice BKNotice `yaml:"bkNotice"`
Esb Esb `yaml:"esb"`
FeatureFlags FeatureFlags `yaml:"featureFlags"`
Network Network `yaml:"network"`
Service Service `yaml:"service"`
Log LogOption `yaml:"log"`
Repo Repository `yaml:"repository"`
BKNotice BKNotice `yaml:"bkNotice"`
Esb Esb `yaml:"esb"`
FeatureFlags FeatureFlags `yaml:"featureFlags"`
LoginAuth LoginAuthSettings `yaml:"loginAuth"`
}

// trySetFlagBindIP try set flag bind ip.
Expand Down Expand Up @@ -135,6 +136,8 @@ type LoginAuthSettings struct {
Provider string `yaml:"provider"`
UseESB bool `yaml:"useEsb"`
GWPubKey string `yaml:"gwPubkey"`
// PrivateVersion 是否是私有化版本
PrivateVersion bool `yaml:"privateVersion"`
}

// trySetFlagBindIP try set flag bind ip.
Expand Down
15 changes: 14 additions & 1 deletion bcs-services/bcs-bscp/pkg/iam/apigw/sync_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const (
)

// ReleaseSwagger 导入swagge 文档
func ReleaseSwagger(opt cc.ApiServerSetting, language, version string) error { // nolint
// nolint:funlen
func ReleaseSwagger(opt cc.ApiServerSetting, language, version string) error {

// 获取需要导入的文档
swaggerData, err := docs.Assets.ReadFile("swagger/bkapigw.swagger.json")
if err != nil {
Expand All @@ -53,6 +55,17 @@ func ReleaseSwagger(opt cc.ApiServerSetting, language, version string) error { /
return fmt.Errorf("create or update gateway failed, err: %s", syncApiResp.Message)
}

if opt.LoginAuth.PrivateVersion {
result, errK := gw.GetApigwPublicKey(syncApiResp.Data.Name)
if errK != nil {
return errK
}
if result.Code != 0 && result.Data.PublicKey == "" {
return fmt.Errorf("get the gateway public key failed, err: %s", result.Message)
}
opt.LoginAuth.GWPubKey = result.Data.PublicKey
}

// 同步环境
syncStageResp, err := gw.SyncStage(syncApiResp.Data.Name, &SyncStageReq{
Name: env,
Expand Down

0 comments on commit 5fb78f9

Please sign in to comment.