mirror of
https://github.com/taigrr/jety.git
synced 2026-04-02 03:19:03 -07:00
fix mutex
This commit is contained in:
4
jety.go
4
jety.go
@@ -162,8 +162,6 @@ func (c *ConfigManager) SetEnvPrefix(prefix string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConfigManager) ReadInConfig() error {
|
func (c *ConfigManager) ReadInConfig() error {
|
||||||
c.mutex.Lock()
|
|
||||||
defer c.mutex.Unlock()
|
|
||||||
// assume config = map[string]any
|
// assume config = map[string]any
|
||||||
confFileData, err := readFile(c.configFileUsed, c.configType)
|
confFileData, err := readFile(c.configFileUsed, c.configType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -174,7 +172,9 @@ func (c *ConfigManager) ReadInConfig() error {
|
|||||||
lower := strings.ToLower(k)
|
lower := strings.ToLower(k)
|
||||||
conf[lower] = ConfigMap{Key: k, Value: v}
|
conf[lower] = ConfigMap{Key: k, Value: v}
|
||||||
}
|
}
|
||||||
|
c.mutex.Lock()
|
||||||
c.mapConfig = conf
|
c.mapConfig = conf
|
||||||
|
c.mutex.Unlock()
|
||||||
c.collapse()
|
c.collapse()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user