fix: timezone parse time issue

This commit is contained in:
2024-03-29 10:09:43 +08:00
parent 5b385a5342
commit c6fbee9a76
6 changed files with 72 additions and 32 deletions

View File

@@ -11,6 +11,17 @@ import (
"gopkg.in/yaml.v3"
)
type DbConfig struct {
Type string `yaml:"type"`
User string `yaml:"user"`
Password string `yaml:"password"`
Host string `yaml:"host"`
Port string `yaml:"port"`
Name string `yaml:"name"`
ConnParam string `yaml:"connParam,omitempty"`
Backup string `yaml:"backup"`
}
// Yaml struct of config
type YamlConfig struct {
Logger struct {
@@ -24,17 +35,20 @@ type YamlConfig struct {
Addr string `yaml:"addr"`
} `yaml:"gtp"`
Database struct {
Type string `yaml:"type"`
User string `yaml:"user"`
Password string `yaml:"password"`
Host string `yaml:"host"`
Port string `yaml:"port"`
Name string `yaml:"name"`
} `yaml:"database"`
Database DbConfig `yaml:"database"`
}
var YamlConf YamlConfig
var YamlConf YamlConfig = NewYamlConfig()
// set default value for yaml config
func NewYamlConfig() YamlConfig {
return YamlConfig{
Database: DbConfig{
Type: "mysql",
ConnParam: "charset=utf8mb4&collation=utf8mb4_general_ci&loc=Local",
},
}
}
func ReadConfig(configFile string) {
yamlFile, err := os.ReadFile(configFile)