package config

import "github.com/beego/beego/v2/server/web"

func GetRemoteHost() (string, error) {
	remoteHost, err := web.AppConfig.String("remoteHost")
	return remoteHost, err
}

func GetShopHost() (string, error) {
	remoteHost, err := web.AppConfig.String("shopHost")
	return remoteHost, err
}

func GetRedisCfg() (RedisCfg, error) {
	host, err := web.AppConfig.String("redis::host")
	if err != nil {
		return RedisCfg{}, err // 返回错误
	}

	port, err := web.AppConfig.Int("redis::port")
	if err != nil {
		return RedisCfg{}, err // 返回错误
	}
	password, err := web.AppConfig.String("redis::password")
	if err != nil {
		return RedisCfg{}, err // 返回错误
	}

	return RedisCfg{
		Host:     host,
		Port:     port,
		Password: password,
	}, nil
}
