Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/backend/cmd/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@ func run(cmd *cobra.Command, args []string) {
// K8S Client
initial.InitClient()

// 初始化数据库配置
// InitConf()

// 初始化RabbitMQ
busEnable, err := beego.AppConfig.Bool("BusEnable")
if err != nil {
panic(err)
}
busEnable := beego.AppConfig.DefaultBool("BusEnable", false)
if busEnable {
initial.InitBus()
}
Expand Down
5 changes: 1 addition & 4 deletions src/backend/cmd/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ func preRunE(cmd *cobra.Command, args []string) error {
}

func run(cmd *cobra.Command, args []string) {
busEnable, err := beego.AppConfig.Bool("BusEnable")
if err != nil {
panic(err)
}
busEnable := beego.AppConfig.DefaultBool("BusEnable", false)
if !busEnable {
panic("Running workers requires BUS FEATURE enabled.")
}
Expand Down
5 changes: 5 additions & 0 deletions src/backend/conf/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ EnableApiKeys = true
BusEnable = false
BusRabbitMQURL = "amqp://guest:guest@127.0.0.1:5672"

# Webhook
EnableWebhook = true
WebhookClientTimeout = 10
WebhookClientWindowSize = 16

# other
# Use Canary/Production Update
# If set app metaData {"mode":"beta"},the app will auto redirect to BetaUrl
Expand Down
4 changes: 2 additions & 2 deletions src/backend/controllers/auth/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *AuthController) Login() {
authType := c.Ctx.Input.Param(":type")
oauth2Name := c.Ctx.Input.Param(":name")
next := c.Ctx.Input.Query("next")
if authType == "" {
if authType == "" || username == "admin" {
authType = models.AuthTypeDB
}
logs.Info("auth type is", authType)
Expand Down Expand Up @@ -116,7 +116,7 @@ func (c *AuthController) Login() {
}

// default token exp time is 3600s.
expSecond := beego.AppConfig.DefaultInt64("TokenLifeTime", 3600)
expSecond := beego.AppConfig.DefaultInt64("TokenLifeTime", 86400)
token := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{
// 签发者
"iss": "wayne",
Expand Down
6 changes: 2 additions & 4 deletions src/backend/initial/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ func InitDb() {
if err != nil {
panic(err)
}
ttl, err := beego.AppConfig.Int("DBConnTTL")
if err != nil {
panic(err)
}
ttl := beego.AppConfig.DefaultInt("DBConnTTL", 30)

db.SetConnMaxLifetime(time.Duration(ttl) * time.Second)

orm.Debug = beego.AppConfig.DefaultBool("ShowSql", false)
Expand Down