diff --git a/internal/config/config.go b/internal/config/config.go index 223362d..306a134 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -2,6 +2,7 @@ package config import ( "fmt" + "sync" "github.com/fsnotify/fsnotify" "github.com/spf13/viper" @@ -17,6 +18,7 @@ type Config struct { } var APPConfig Config +var configMu sync.Mutex const ( Url = "url" @@ -70,6 +72,8 @@ func InitConfig() { } func WriteConfig(key string, value any) { + configMu.Lock() viper.Set(key, value) viper.WriteConfig() + configMu.Unlock() }