mirror of
https://github.com/taigrr/jety.git
synced 2026-04-02 03:19:03 -07:00
type block, remove ae param
This commit is contained in:
@@ -2,7 +2,7 @@ package config
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
var defaultConfigManager = NewConfigManager(true)
|
var defaultConfigManager = NewConfigManager()
|
||||||
|
|
||||||
func GetIntSlice(key string) []int {
|
func GetIntSlice(key string) []int {
|
||||||
return defaultConfigManager.GetIntSlice(key)
|
return defaultConfigManager.GetIntSlice(key)
|
||||||
|
|||||||
40
jety.go
40
jety.go
@@ -12,35 +12,37 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
type configType string
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ConfigTypeTOML configType = "toml"
|
ConfigTypeTOML configType = "toml"
|
||||||
ConfigTypeYAML configType = "yaml"
|
ConfigTypeYAML configType = "yaml"
|
||||||
ConfigTypeJSON configType = "json"
|
ConfigTypeJSON configType = "json"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigMap struct {
|
type (
|
||||||
Key string
|
configType string
|
||||||
Value any
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConfigManager struct {
|
ConfigMap struct {
|
||||||
configName string
|
Key string
|
||||||
configFileUsed string
|
Value any
|
||||||
configType configType
|
}
|
||||||
envPrefix string
|
|
||||||
mapConfig map[string]ConfigMap
|
ConfigManager struct {
|
||||||
defaultConfig map[string]ConfigMap
|
configName string
|
||||||
envConfig map[string]ConfigMap
|
configFileUsed string
|
||||||
combinedConfig map[string]ConfigMap
|
configType configType
|
||||||
mutex sync.RWMutex
|
envPrefix string
|
||||||
explicitDefaults bool
|
mapConfig map[string]ConfigMap
|
||||||
}
|
defaultConfig map[string]ConfigMap
|
||||||
|
envConfig map[string]ConfigMap
|
||||||
|
combinedConfig map[string]ConfigMap
|
||||||
|
mutex sync.RWMutex
|
||||||
|
explicitDefaults bool
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
var ErrConfigFileNotFound = errors.New("config File Not Found")
|
var ErrConfigFileNotFound = errors.New("config File Not Found")
|
||||||
|
|
||||||
func NewConfigManager(automaticEnv bool) *ConfigManager {
|
func NewConfigManager() *ConfigManager {
|
||||||
cm := ConfigManager{}
|
cm := ConfigManager{}
|
||||||
cm.envConfig = make(map[string]ConfigMap)
|
cm.envConfig = make(map[string]ConfigMap)
|
||||||
cm.mapConfig = make(map[string]ConfigMap)
|
cm.mapConfig = make(map[string]ConfigMap)
|
||||||
|
|||||||
Reference in New Issue
Block a user