Skip to content

Commit

Permalink
feat: merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu327 committed Jan 13, 2022
2 parents 5e360eb + 2b02b54 commit 57a748f
Show file tree
Hide file tree
Showing 27 changed files with 1,276 additions and 225 deletions.
26 changes: 23 additions & 3 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,19 @@ func initDatabase() {
panic("database bk-iam should be configured")
}

if globalConfig.EnableBkAuth {
database.InitDBClients(&defaultDBConfig, nil)
log.Info("init Database success")
return
}

// TODO: 不应该成为强依赖
bkPaaSDBConfig, ok := globalConfig.DatabaseMap["open_paas"]
if !ok {
panic("database open_paas should be configured")
panic("bkauth is not enabled, so database open_paas should be configured")
}

database.InitDBClients(&defaultDBConfig, &bkPaaSDBConfig)

log.Info("init Database success")
}

Expand Down Expand Up @@ -142,7 +148,21 @@ func initSupportShieldFeatures() {
}

func initComponents() {
component.InitComponentClients()
component.InitBkRemoteResourceClient()

if globalConfig.EnableBkAuth {
bkAuthHost, ok := globalConfig.HostMap["bkauth"]
if !ok {
panic("bkauth is enabled, so host bkauth should be configured")
}

if globalConfig.BkAppCode == "" || globalConfig.BkAppSecret == "" {
panic("bkauth is enabled, but iam's bkAppCode and bkAppSecret is not configured")
}

component.InitBkAuthClient(bkAuthHost.Addr, globalConfig.BkAppCode, globalConfig.BkAppSecret)
log.Infof("init bkauth client success, host = %s", bkAuthHost.Addr)
}
}

func initQuota() {
Expand Down
Loading

0 comments on commit 57a748f

Please sign in to comment.