作者 yangfu

1.修改环境变量

... ... @@ -11,8 +11,8 @@ AccessKeySecret ="aLZXwK8pgrs10Ws03qcN7NsrSXFVsg"
cname ="https://media.fjmaimaimai.com/"
#数据库相关
MYSQL_USER = "${MYSQL_USER||root}"
MYSQL_PASSWORD = "${MYSQL_PASSWORD||sutianxia2018}"
MYSQL_HOST = "${MYSQL_HOST||101.37.68.23}"
MYSQL_PORT = "${MYSQL_PORT||3306}"
MYSQL_DB_NAME = "${MYSQL_DB_NAME||mmm_open_test}"
\ No newline at end of file
MYSQL_USER = "${MYSQL_USER||root1}"
MYSQL_PASSWORD = "${MYSQL_PASSWORD||sutianxia20181}"
MYSQL_HOST = "${MYSQL_HOST||101.37.68.231}"
MYSQL_PORT = "${MYSQL_PORT||33061}"
MYSQL_DB_NAME = "${MYSQL_DB_NAME||mmm_open_test1}"
\ No newline at end of file
... ...
... ... @@ -79,6 +79,8 @@ spec:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "mmm_open_test"
- name: RUN_MODE
value: "test"
- name: LOG_LEVEL
... ...
package bgorm
import (
"fmt"
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
"openapi/pkg/constant"
_ "openapi/pkg/infrastructure/bgorm/model"
"openapi/pkg/infrastructure/log"
)
func init() {
aliasName := "default"
_ = orm.RegisterDataBase(aliasName, "mysql", constant.MYSQL_DATA_SOURCE)
if err := orm.RegisterDataBase(aliasName, "mysql", constant.MYSQL_DATA_SOURCE); err != nil {
log.Error(fmt.Sprintf("【MYSQL】注册数据库失败:%v source:%v", err, constant.MYSQL_DATA_SOURCE))
return
}
orm.SetMaxIdleConns(aliasName, constant.MYSQL_MAX_IDLE)
orm.SetMaxOpenConns(aliasName, constant.MYSQL_MAX_OPEN)
}
... ...