From 3464599cd57e4fa472ee4ff099e019f8eda1fdf9 Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 6 Feb 2023 14:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3yaml=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5=E8=A7=A3=E6=9E=90=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 6813f9d..ec47b29 100644 --- a/config/config.go +++ b/config/config.go @@ -2,24 +2,25 @@ package config import ( "fmt" - "github.com/spf13/viper" "os" "strings" + + "github.com/spf13/viper" ) var config *Config type Config struct { - ChatGpt ChatGptConfig `json:"chatgpt"` + ChatGpt ChatGptConfig `json:"chatgpt" mapstructure:"chatgpt" yaml:"chatgpt"` } type ChatGptConfig struct { - Token string `json:"token,omitempty" json:"token,omitempty"` - Wechat *string `json:"wechat,omitempty"` - WechatKeyword *string `json:"wechat_keyword"` - Telegram *string `json:"telegram"` - TgWhitelist *string `json:"tg_whitelist"` - TgKeyword *string `json:"tg_keyword"` + Token string `json:"token,omitempty" mapstructure:"token,omitempty" yaml:"token,omitempty"` + Wechat *string `json:"wechat,omitempty" mapstructure:"wechat,omitempty" yaml:"wechat,omitempty"` + WechatKeyword *string `json:"wechat_keyword" mapstructure:"wechat_keyword" yaml:"wechat_keyword"` + Telegram *string `json:"telegram" mapstructure:"telegram" yaml:"telegram"` + TgWhitelist *string `json:"tg_whitelist" mapstructure:"tg_whitelist" yaml:"tg_whitelist"` + TgKeyword *string `json:"tg_keyword" mapstructure:"tg_keyword" yaml:"tg_keyword"` } func LoadConfig() error {