Example #1
0
//indexinfo to cfg
func IndexInfoToCfg(this *IndexInfo, cfg *goconfig.Config) {

	repeatetimer, _ := cfg.Get("config::repeatetimer")
	singletimer, _ := cfg.Get("config::singletimer")

	configpage, _ := cfg.Get("config::configpage")
	sites, _ := cfg.Get("config::sites")

	cfg.Set("config", "repeatetimer", repeatetimer)
	cfg.Set("config", "singletimer", singletimer)
	cfg.Set("config", "configpage", configpage)
	cfg.Set("config", "sites", sites)
	cfg.Set("config", "transferes", this.Transferes)
	cfg.Set("config", "nosql", this.Nosql)
}
Example #2
0
//indexinfo to ini
func joinToIni(bakCfg *goconfig.Config, cfg *goconfig.Config) {
	f_dbname, _ := cfg.Get("dbconfig::f_dbname")
	t_dbname, _ := cfg.Get("dbconfig::t_dbname")

	f_dbtype, _ := cfg.Get("dbconfig::f_dbtype")
	f_driver, _ := cfg.Get("dbconfig::f_driver")

	f_dburl, _ := bakCfg.Get("dbconfig::dburl")
	f_ip, _ := bakCfg.Get("dbconfig::ip")
	f_port, _ := bakCfg.Get("dbconfig::port")
	f_user, _ := bakCfg.Get("dbconfig::user")
	f_password, _ := bakCfg.Get("dbconfig::password")

	f_dburl_cfg, _ := cfg.Get("dbconfig::dburl")
	f_ip_cfg, _ := cfg.Get("dbconfig::ip")
	f_port_cfg, _ := cfg.Get("dbconfig::port")
	f_user_cfg, _ := cfg.Get("dbconfig::user")
	f_password_cfg, _ := cfg.Get("dbconfig::password")

	if len(f_dburl) <= 0 {
		f_dburl = f_dburl_cfg
	}
	if len(f_ip) <= 0 {
		f_ip = f_ip_cfg
	}
	if len(f_port) <= 0 {
		f_port = f_port_cfg
	}
	if len(f_user) <= 0 {
		f_user = f_user_cfg
	}
	if len(f_password) <= 0 {
		f_password = f_password_cfg
	}

	f_password = strings.Replace(f_password, "enc`", "", 1)

	t_dbtype, _ := cfg.Get("dbconfig::t_dbtype")
	t_driver, _ := cfg.Get("dbconfig::t_driver")
	t_dburl, _ := cfg.Get("dbconfig::t_dburl")
	t_ip, _ := cfg.Get("dbconfig::t_ip")
	t_port, _ := cfg.Get("dbconfig::t_port")
	t_user, _ := cfg.Get("dbconfig::t_user")
	t_password, _ := cfg.Get("dbconfig::t_password")

	cfg.Set("dbconfig", "f_dbtype", f_dbtype)
	cfg.Set("dbconfig", "f_driver", f_driver)
	cfg.Set("dbconfig", "f_dburl", f_dburl)
	cfg.Set("dbconfig", "f_ip", f_ip)
	cfg.Set("dbconfig", "f_port", f_port)
	cfg.Set("dbconfig", "f_dbname", f_dbname)
	cfg.Set("dbconfig", "f_user", f_user)
	cfg.Set("dbconfig", "f_password", f_password)

	cfg.Set("dbconfig", "t_dbtype", t_dbtype)
	cfg.Set("dbconfig", "t_driver", t_driver)
	cfg.Set("dbconfig", "t_dburl", t_dburl)
	cfg.Set("dbconfig", "t_ip", t_ip)
	cfg.Set("dbconfig", "t_port", t_port)
	cfg.Set("dbconfig", "t_dbname", t_dbname)
	cfg.Set("dbconfig", "t_user", t_user)
	cfg.Set("dbconfig", "t_password", t_password)

	sysid, _ := cfg.Get("dbconfig::sysid")
	systype, _ := cfg.Get("dbconfig::systype")
	sysname, _ := cfg.Get("dbconfig::sysname")
	company, _ := cfg.Get("dbconfig::company")
	platform, err := cfg.Get("dbconfig::platform")
	logger.Info("platform===========================", platform, sysname, err)
	cfg.Set("dbconfig", "sysid", sysid)
	cfg.Set("dbconfig", "systype", systype)
	cfg.Set("dbconfig", "sysname", sysname)
	cfg.Set("dbconfig", "company", company)
	cfg.Set("dbconfig", "platform", platform)

}
Example #3
0
//indexinfo to ini
func IndexInfoToIni(this *IndexInfo, cfg *goconfig.Config) {
	f_dbname, _ := cfg.Get("dbconfig::f_dbname")
	t_dbname, _ := cfg.Get("dbconfig::t_dbname")

	f_dbtype, _ := cfg.Get("dbconfig::f_dbtype")
	f_driver, _ := cfg.Get("dbconfig::f_driver")
	t_dbtype, _ := cfg.Get("dbconfig::t_dbtype")
	t_driver, _ := cfg.Get("dbconfig::t_driver")

	var f_dburl string = ""
	if strings.EqualFold(f_dbtype, "mysql") {
		f_dburl_arr := []string{"jdbc:mysql://", this.F_ip, ":", this.F_port, "/", f_dbname, "?useUnicode=true&characterEncoding=utf-8&useOldAliasMetadataBehavior=true"}
		f_dburl = strings.Join(f_dburl_arr, "")
	} else if strings.EqualFold(f_dbtype, "mssql") {
		f_dburl_arr := []string{"jdbc:microsoft:sqlserver://", this.F_ip, ":", this.F_port, ";", "DatabaseName=", f_dbname}
		f_dburl = strings.Join(f_dburl_arr, "")
	}
	t_dburl_arr := []string{"jdbc:mysql://", this.T_ip, ":", this.T_port, "/", t_dbname, "?useUnicode=true&characterEncoding=utf-8&useOldAliasMetadataBehavior=true"}
	var t_dburl = strings.Join(t_dburl_arr, "")

	cfg.Set("dbconfig", "f_dbtype", f_dbtype)
	cfg.Set("dbconfig", "f_driver", f_driver)
	cfg.Set("dbconfig", "f_dburl", f_dburl)
	cfg.Set("dbconfig", "f_ip", this.F_ip)
	cfg.Set("dbconfig", "f_port", this.F_port)
	cfg.Set("dbconfig", "f_dbname", f_dbname)
	cfg.Set("dbconfig", "f_user", this.F_username)
	cfg.Set("dbconfig", "f_password", this.F_password)

	cfg.Set("dbconfig", "t_dbtype", t_dbtype)
	cfg.Set("dbconfig", "t_driver", t_driver)
	cfg.Set("dbconfig", "t_dburl", t_dburl)
	cfg.Set("dbconfig", "t_ip", this.T_ip)
	cfg.Set("dbconfig", "t_port", this.T_port)
	cfg.Set("dbconfig", "t_dbname", t_dbname)
	cfg.Set("dbconfig", "t_user", this.T_username)
	cfg.Set("dbconfig", "t_password", this.T_password)

	sysid, _ := cfg.Get("dbconfig::sysid")
	systype, _ := cfg.Get("dbconfig::systype")
	sysname, _ := cfg.Get("dbconfig::sysname")
	company, _ := cfg.Get("dbconfig::company")
	platform, err := cfg.Get("dbconfig::platform")
	logger.Info("platform===========================", platform, sysname, err)
	cfg.Set("dbconfig", "sysid", sysid)
	cfg.Set("dbconfig", "systype", systype)
	cfg.Set("dbconfig", "sysname", sysname)
	cfg.Set("dbconfig", "company", company)
	cfg.Set("dbconfig", "platform", platform)

}