fix: remove import cycle

This commit is contained in:
Derrick Hammer 2024-02-27 03:57:17 -05:00
parent 6e3e096be9
commit b51f28ea64
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 8 additions and 12 deletions

View File

@ -4,7 +4,6 @@ import (
"errors"
"fmt"
_logger "git.lumeweb.com/LumeWeb/portal/logger"
"github.com/docker/go-units"
"github.com/spf13/viper"
"go.uber.org/zap"
@ -29,7 +28,7 @@ type Manager struct {
}
func NewManager() (*Manager, error) {
v, err := newConfig(nil)
v, err := newConfig()
if err != nil {
return nil, err
}
@ -133,10 +132,8 @@ func (m *Manager) Save() error {
return nil
}
func newConfig(logger *zap.Logger) (*viper.Viper, error) {
if logger == nil {
logger = _logger.NewFallbackLogger()
}
func newConfig() (*viper.Viper, error) {
logger := newFallbackLogger()
viper.SetConfigName("config")
viper.SetConfigType("yaml")
@ -166,3 +163,8 @@ func newConfig(logger *zap.Logger) (*viper.Viper, error) {
return viper.GetViper(), nil
}
func newFallbackLogger() *zap.Logger {
l, _ := zap.NewDevelopment()
return l
}

View File

@ -9,12 +9,6 @@ import (
"go.uber.org/zap/zapcore"
)
func NewFallbackLogger() *zap.Logger {
logger, _ := zap.NewDevelopment()
return logger
}
func NewLogger(cm *config.Manager) (*zap.Logger, *zap.AtomicLevel) {
// Create a new atomic level