WEQServer/internal/config/config.go

45 lines
1.2 KiB
Go
Raw Normal View History

package config
import "time"
type Server struct {
Addr string `yaml:"addr"`
Port uint32 `yaml:"port"`
LogLevel uint16 `yaml:"log_level"`
}
type Redis struct {
Addr string `yaml:"addr"`
Password string `yaml:"password"`
ReadTimeout time.Duration `yaml:"read_timeout"`
WriteTimeout time.Duration `yaml:"write_timeout"`
DB int `yaml:"db"`
}
type Data struct {
Redis *Redis `yaml:"redis"`
}
type AccuWeather struct {
APIKey string `yaml:"api_key"`
CitiesSearchByIPURL string `yaml:"cities_search_by_ip_url"`
CitiesSearchURL string `yaml:"cities_search_url"`
CurrentConditionURL string `yaml:"current_condition_url"`
DailyForecastsURL string `yaml:"daily_forecasts_url"` // 查7填预报需要更高级的账号。默认先用查5天的。后续可以通过配置来改。
}
type Config struct {
Server *Server `yaml:"server"`
Data *Data `yaml:"data"`
AccuWeather *AccuWeather `yaml:"accu_weather"`
}
type AppSecret struct {
Id string `yaml:"id" json:"id"`
Secret string `yaml:"secret" json:"secret"`
}
type Apps struct {
AppSecrets []AppSecret `yaml:"app_secrets" json:"app_secrets"`
}