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

@@ -13,6 +13,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 {
@@ -39,15 +50,7 @@ type YamlConfig struct {
MmlHome string `yaml:"mmlHome"`
} `yaml:"sshd"`
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"`
Backup string `yaml:"backup"`
} `yaml:"database"`
Database DbConfig `yaml:"database"`
OMC struct {
HttpUri string `yaml:"httpUri"`
@@ -55,7 +58,17 @@ type YamlConfig struct {
} `yaml:"omc"`
}
var yamlConfig YamlConfig
var yamlConfig 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)