Esempio n. 1
0
func GetSubSites() string {
	value, _ := tools.RedisStorageInstance.GetKey(SubSitesRedisKey)
	if len(value) != 0 {
		return value
	}
	config := models.Config{}
	config.Key = "sub-sites"
	err := config.Read("key")
	if err != nil {
		fmt.Println("获取配置【sub-sites】失败")
		return ""
	}
	tools.RedisStorageInstance.SetKey(SubSitesRedisKey, config.Value)
	return config.Value
}
Esempio n. 2
0
func GetRedirectURL() string {
	value, _ := tools.RedisStorageInstance.GetKey(RedirectURLKey)
	if len(value) != 0 {
		return value
	}

	config := models.Config{}
	config.Key = "redirectURL"
	err := config.Read("key")
	if err != nil {
		fmt.Println("获取配置【redirectURL】失败")
		return ""
	}

	tools.RedisStorageInstance.SetKey(RedirectURLKey, config.Value)

	return config.Value
}
Esempio n. 3
0
func InitConfig() {
	// sub-sites
	config := models.Config{}
	config.Key = "sub-sites"
	err := config.Read("key")
	if err != nil {
		fmt.Println("获取配置【sub-sites】失败")
		return
	}
	tools.RedisStorageInstance.SetKey(SubSitesRedisKey, config.Value)

	// redirectURL
	config = models.Config{}
	config.Key = "redirectURL"
	err = config.Read("key")
	if err != nil {
		fmt.Println("获取配置【redirectURL】失败")
		return
	}

	tools.RedisStorageInstance.SetKey(RedirectURLKey, config.Value)
}