Skip to content

Commit c80b8ee

Browse files
author
jikun.zhang
committed
更新数据库连接配置
Signed-off-by: jikun.zhang <jikun.zhang@megatronix.co>
1 parent dc99a27 commit c80b8ee

527 files changed

Lines changed: 23675 additions & 26291 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
module PrometheusAlert
22

3-
go 1.15
3+
go 1.16
44

55
require (
6-
github.com/aliyun/alibaba-cloud-sdk-go v1.61.641
7-
github.com/astaxie/beego v1.12.1
8-
github.com/baidubce/bce-sdk-go v0.9.32
6+
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1537
7+
github.com/astaxie/beego v1.12.3
8+
github.com/baidubce/bce-sdk-go v0.9.111
99
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
10-
github.com/go-sql-driver/mysql v1.4.1
11-
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.0.0-rc1.0.20201106042948-366879b11047
12-
github.com/lib/pq v1.9.0
10+
github.com/go-sql-driver/mysql v1.6.0
11+
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
12+
github.com/lib/pq v1.10.4
1313
github.com/mattn/go-sqlite3 v2.0.3+incompatible
14-
github.com/olivere/elastic/v7 v7.0.29
15-
github.com/prometheus/client_golang v1.8.0
16-
github.com/robfig/cron/v3 v3.0.0
17-
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
18-
github.com/smartystreets/goconvey v1.6.4
19-
github.com/ysicing/workwxbot v1.0.1
14+
github.com/olivere/elastic/v7 v7.0.32
15+
github.com/prometheus/client_golang v1.12.1
16+
github.com/robfig/cron/v3 v3.0.1
17+
github.com/smartystreets/goconvey v1.7.2
18+
github.com/ysicing/workwxbot v1.1.0
2019
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
2120
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
2221
)

go.sum

Lines changed: 335 additions & 251 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ func init() {
4747
orm.RegisterDataBase("default", "sqlite3", Db_name, 10)
4848
case "mysql":
4949
orm.RegisterDriver("mysql", orm.DRMySQL)
50-
orm.RegisterDataBase("default", "mysql", beego.AppConfig.String("db_user")+":"+beego.AppConfig.String("db_password")+"@tcp("+beego.AppConfig.String("db_host")+":"+beego.AppConfig.String("db_port")+")/"+beego.AppConfig.String("db_name")+"?charset=utf8mb4")
50+
dataSource := beego.AppConfig.String("db_user") + ":" + beego.AppConfig.String("db_password") + "@tcp(" + beego.AppConfig.String("db_host") + ":" + beego.AppConfig.String("db_port") + ")/" + beego.AppConfig.String("db_name") + "?charset=utf8mb4"
51+
orm.RegisterDataBase("default", "mysql", dataSource)
52+
orm.SetMaxIdleConns("default", 10)
53+
orm.SetMaxOpenConns("default", 10)
5154
case "postgres":
5255
orm.RegisterDriver("postgres", orm.DRPostgres)
53-
orm.RegisterDataBase("default", "postgres", "user="+beego.AppConfig.String("db_user")+" password="+beego.AppConfig.String("db_password")+" dbname="+beego.AppConfig.String("db_name")+" host="+beego.AppConfig.String("db_host")+" port="+beego.AppConfig.String("db_port")+" sslmode=disable")
56+
dataSource := "user=" + beego.AppConfig.String("db_user") + " password=" + beego.AppConfig.String("db_password") + " dbname=" + beego.AppConfig.String("db_name") + " host=" + beego.AppConfig.String("db_host") + " port=" + beego.AppConfig.String("db_port") + " sslmode=disable"
57+
orm.RegisterDataBase("default", "postgres", dataSource)
58+
orm.SetMaxIdleConns("default", 10)
59+
orm.SetMaxOpenConns("default", 10)
5460
default:
5561
// 检查数据库文件
5662
Db_name := "./db/PrometheusAlertDB.db"
@@ -86,7 +92,7 @@ func main() {
8692

8793
// 定时删除日志
8894
RecordLive, _ := beego.AppConfig.Int("RecordLive")
89-
if (RecordLive == 1){
95+
if RecordLive == 1 {
9096
RecordLiveDay, _ := beego.AppConfig.Int("RecordLiveDay")
9197
logs.Info("[main] 告警记录生存周期: %dd", RecordLiveDay)
9298
c := cron.New(cron.WithSeconds())

vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/sts_role_arn_credential.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ram_role_arn.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go

Lines changed: 60 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/config.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)