Commit c16b36b5 authored by 陈子龙's avatar 陈子龙

Merge branch 'dev-czl' into dev

parents a2b92094 a6c3d61e
...@@ -56,23 +56,22 @@ func initConfig() { ...@@ -56,23 +56,22 @@ func initConfig() {
conf.LoggerLevel = util.SetEnvStr("LOG_LEVEL", "info") conf.LoggerLevel = util.SetEnvStr("LOG_LEVEL", "info")
conf.RunMode = util.SetEnvStr("GIN_MODE", "debug") // project run mode, available parameters: debug、release conf.RunMode = util.SetEnvStr("GIN_MODE", "debug") // project run mode, available parameters: debug、release
conf.Options = &conf.Config{ conf.Options = &conf.Config{
Prefix: *prefix, Prefix: *prefix,
DbURL: util.SetEnvStr("DB_URL", "host=localhost port=9010 user=postgres password=passwd123 dbname=postgres sslmode=disable"), DbURL: util.SetEnvStr("DB_URL", "host=localhost port=9010 user=postgres password=passwd123 dbname=postgres sslmode=disable"),
DbDriver: util.SetEnvStr("DB_DRIVER", "postgres"), DbDriver: util.SetEnvStr("DB_DRIVER", "postgres"),
RedisURL: util.SetEnvStr("REDIS_URL", "localhost:7001"), RedisURL: util.SetEnvStr("REDIS_URL", "localhost:7001"),
RedisDB: 0, RedisDB: 0,
RedisTag: "bg", RedisTag: "bg",
LogDirPrefix: util.SetEnvStr("LOG_DIR_PREFIX", "/app/log"), // 日志目录 LogDirPrefix: util.SetEnvStr("LOG_DIR_PREFIX", "/app/log"), // 日志目录
LogDirName: util.SetEnvStr("LOG_NAME", "syslog"), // 日志名称 LogDirName: util.SetEnvStr("LOG_NAME", "syslog"), // 日志名称
LogSaveDays: util.SetEnvInt("LOG_SAVE_DAYS", 7), // 日志最大存储天数 LogSaveDays: util.SetEnvInt("LOG_SAVE_DAYS", 7), // 日志最大存储天数
LogMode: util.SetEnvInt("LOG_MODE", 1), // 1.标准打印 2.输出文件 LogMode: util.SetEnvInt("LOG_MODE", 1), // 1.标准打印 2.输出文件
ArgBool: util.SetEnvBool("ARG_BOOL", false), // 示例参数 ArgBool: util.SetEnvBool("ARG_BOOL", false), // 示例参数
ArgInt: util.SetEnvInt("ARG_INT", 10), // 示例参数 ArgInt: util.SetEnvInt("ARG_INT", 10), // 示例参数
MinioServer: util.SetEnvStr("MINIO_SERVER", "https://cache.wodcloud.com"), // Minio 服务地址 MinioServer: util.SetEnvStr("MINIO_SERVER", "https://cache.wodcloud.com"), // Minio 服务地址
MinioAccessKey: util.SetEnvStr("MINIO_ACCESS_KEY", "beagleadmin"), // Minio Access Key MinioAccessKey: util.SetEnvStr("MINIO_ACCESS_KEY", "beagleadmin"), // Minio Access Key
MinioSecretKey: util.SetEnvStr("MINIO_SECRET_KEY", "H76cPmwvH7vJ"), // Minio Secret MinioSecretKey: util.SetEnvStr("MINIO_SECRET_KEY", "H76cPmwvH7vJ"), // Minio Secret
MinioBucket: util.SetEnvStr("MINIO_BUCKET", "so-operation"), // Minio Bucket MinioBucket: util.SetEnvStr("MINIO_BUCKET", "so-operation"), // Minio Bucket
//TempDirPrefix: util.SetEnvStr("TEMP_DIR_PREFIX", "/app/xlsx/"), //模板目录前缀
PrometheusHost: util.SetEnvStr("PROMETHEUS_HOST", "https://prometheus.wodcloud.com"), // Prometheus Host PrometheusHost: util.SetEnvStr("PROMETHEUS_HOST", "https://prometheus.wodcloud.com"), // Prometheus Host
AccessRuleModeKey: "accessRuleMode", AccessRuleModeKey: "accessRuleMode",
LocationUrl: util.SetEnvStr("LOCATION_URL", "https://apis.map.qq.com/ws/location/v1/ip"), LocationUrl: util.SetEnvStr("LOCATION_URL", "https://apis.map.qq.com/ws/location/v1/ip"),
......
...@@ -412,46 +412,46 @@ func (h *HostManageSvc) ListStateHostManage(req request.StateHostManageReq) (err ...@@ -412,46 +412,46 @@ func (h *HostManageSvc) ListStateHostManage(req request.StateHostManageReq) (err
} }
// 读取hosts中的主机组 // 读取hosts中的主机组
//hosts, err := tools.HostsToJson() hosts, err := tools.HostsToJson()
//if err != nil { if err != nil {
// err = resp.MarshalError.WithError(err) err = resp.MarshalError.WithError(err)
// session.Rollback() session.Rollback()
// return return
//} }
//
//if _, ok := hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"]; !ok { if _, ok := hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"]; !ok {
// // 不存在 // 不存在
// hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"] = nil hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"] = nil
//} }
////新增主机分组列表 //新增主机分组列表
//for _, v := range hostManageList { for _, v := range hostManageList {
// hostsIp := "" hostsIp := ""
// if v.VoucherType == 0 { if v.VoucherType == 0 {
// hostsIp = fmt.Sprintf("%s ansible_ssh_host=%s ansible_ssh_port=%s ansible_ssh_user=\"%s\" ansible_ssh_pass=\"%s\" ansible_host_key_checking=false", hostsIp = fmt.Sprintf("%s ansible_ssh_host=%s ansible_ssh_port=%s ansible_ssh_user=\"%s\" ansible_ssh_pass=\"%s\" ansible_host_key_checking=false",
// AnsibleIp+fmt.Sprintf("%d", v.Id), v.Ip, v.Port, v.UserName, v.Password) AnsibleIp+fmt.Sprintf("%d", v.Id), v.Ip, v.Port, v.UserName, v.Password)
// } else { } else {
// hostsIp = fmt.Sprintf("%s ansible_ssh_host=%s ansible_ssh_port=%s ansible_ssh_user=\"%s\" ansible_ssh_private_key_file=/root/.ssh/id_rsa ansible_host_key_checking=false", hostsIp = fmt.Sprintf("%s ansible_ssh_host=%s ansible_ssh_port=%s ansible_ssh_user=\"%s\" ansible_ssh_private_key_file=/root/.ssh/id_rsa ansible_host_key_checking=false",
// AnsibleIp+fmt.Sprintf("%d", v.Id), v.Ip, v.Port, v.UserName) AnsibleIp+fmt.Sprintf("%d", v.Id), v.Ip, v.Port, v.UserName)
// } }
//
// flag := 0 flag := 0
// for _, v1 := range hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"] { for _, v1 := range hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"] {
// if v1 == hostsIp { if v1 == hostsIp {
// flag = 1 flag = 1
// } }
// } }
// if flag == 0 { if flag == 0 {
// hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"] = append(hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"], hostsIp) hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"] = append(hosts["["+AnsibleGroup+fmt.Sprintf("%d", req.Id)+"]"], hostsIp)
// } }
//} }
//
////写入hosts //写入hosts
//err = tools.MapToSaveHosts(hosts) err = tools.MapToSaveHosts(hosts)
//if err != nil { if err != nil {
// err = resp.MarshalError.WithError(err) err = resp.MarshalError.WithError(err)
// session.Rollback() session.Rollback()
// return return
//} }
for _, v := range hostManageList { for _, v := range hostManageList {
//修改状态 //修改状态
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment