diff --git a/api/store/mysql.go b/api/store/mysql.go index 6dabfdf0..d860a5f5 100644 --- a/api/store/mysql.go +++ b/api/store/mysql.go @@ -21,6 +21,9 @@ func NewGormConfig() *gorm.Config { func NewMysql(config *gorm.Config, appConfig *types.AppConfig) (*gorm.DB, error) { db, err := gorm.Open(mysql.Open(appConfig.MysqlDns), config) + if err != nil { + return nil, err + } sqlDB, err := db.DB() if err != nil { @@ -29,8 +32,6 @@ func NewMysql(config *gorm.Config, appConfig *types.AppConfig) (*gorm.DB, error) sqlDB.SetMaxIdleConns(32) sqlDB.SetMaxOpenConns(512) sqlDB.SetConnMaxLifetime(time.Hour) - if err != nil { - return nil, err - } + return db, nil } diff --git a/build/build.sh b/build/build.sh index add656e3..55d43027 100755 --- a/build/build.sh +++ b/build/build.sh @@ -9,7 +9,7 @@ make clean linux cd ../web npm run build -cd ../docker +cd ../build # remove docker image if exists docker rmi -f registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-api:$version @@ -23,4 +23,4 @@ docker build --platform linux/amd64 -t registry.cn-shenzhen.aliyuncs.com/geekmas if [ "$2" = "push" ];then docker push registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-api:$version docker push registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-web:$version -fi \ No newline at end of file +fi