mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 23:41:23 +02:00
refactor(config): remove unused ActiveConfig
This commit is contained in:
@@ -70,7 +70,6 @@ func SetState(state config.State) {
|
|||||||
defer stateMu.Unlock()
|
defer stateMu.Unlock()
|
||||||
|
|
||||||
cfg := state.Value()
|
cfg := state.Value()
|
||||||
config.ActiveConfig.Store(cfg)
|
|
||||||
config.ActiveState.Store(state)
|
config.ActiveState.Store(state)
|
||||||
acl.ActiveConfig.Store(cfg.ACL)
|
acl.ActiveConfig.Store(cfg.ACL)
|
||||||
entrypoint.ActiveConfig.Store(&cfg.Entrypoint)
|
entrypoint.ActiveConfig.Store(&cfg.Entrypoint)
|
||||||
@@ -87,7 +86,7 @@ func HasState() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Value() *config.Config {
|
func Value() *config.Config {
|
||||||
return config.ActiveConfig.Load()
|
return config.ActiveState.Load().Value()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (state *state) InitFromFile(filename string) error {
|
func (state *state) InitFromFile(filename string) error {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"sync/atomic"
|
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/yusing/godoxy/agent/pkg/agent"
|
"github.com/yusing/godoxy/agent/pkg/agent"
|
||||||
@@ -42,14 +41,6 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// nil-safe
|
|
||||||
var ActiveConfig atomic.Pointer[Config]
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
cfg := DefaultConfig()
|
|
||||||
ActiveConfig.Store(&cfg)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Validate(data []byte) gperr.Error {
|
func Validate(data []byte) gperr.Error {
|
||||||
var model Config
|
var model Config
|
||||||
return serialization.UnmarshalValidateYAML(data, &model)
|
return serialization.UnmarshalValidateYAML(data, &model)
|
||||||
|
|||||||
Reference in New Issue
Block a user