forked from grassrootseconomics/visedriver
added the grassrootseconomics/go-vise package to visedriver
This commit is contained in:
@@ -4,13 +4,13 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
slogging "github.com/grassrootseconomics/go-vise/slog"
|
||||
)
|
||||
|
||||
var (
|
||||
logg = logging.NewVanilla().WithDomain("visedriver-config")
|
||||
logg = slogging.Get().With("component", "visedriver-config")
|
||||
defaultLanguage = "eng"
|
||||
languages []string
|
||||
DefaultLanguage string
|
||||
@@ -136,7 +136,7 @@ func GetConns() (storage.Conns, error) {
|
||||
|
||||
// LoadConfig initializes the configuration values after environment variables are loaded.
|
||||
func LoadConfig() error {
|
||||
configManager = NewConfig(logg)
|
||||
configManager = NewConfig()
|
||||
|
||||
// Add configuration keys with validation
|
||||
configManager.AddKey("HOST", "127.0.0.1", false, nil)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build configreport
|
||||
// +build configreport
|
||||
|
||||
package config
|
||||
@@ -7,12 +8,12 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
slogging "github.com/grassrootseconomics/go-vise/slog"
|
||||
)
|
||||
|
||||
// go test -tags configreport ./config/... ---> run with tag
|
||||
func TestConfig(t *testing.T) {
|
||||
logger := logging.NewVanilla().WithDomain("test")
|
||||
logger := slogging.Get().With("component", "test")
|
||||
cfg := NewConfig(logger)
|
||||
|
||||
t.Run("Default Values", func(t *testing.T) {
|
||||
|
||||
@@ -2,20 +2,17 @@
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
)
|
||||
|
||||
type Config struct{}
|
||||
|
||||
func NewConfig(logger logging.Vanilla) *Config {
|
||||
return &Config{}
|
||||
func NewConfig() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func (c *Config) AddKey(key string, defaultValue string, sensitive bool, validator func(string) error) {}
|
||||
func (c *Config) AddKey(key string, defaultValue string, sensitive bool, validator func(string) error) {
|
||||
}
|
||||
|
||||
func (c *Config) GetValue(key string) (string, error) {
|
||||
return "", nil
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (c *Config) Report(level string) {}
|
||||
func (c *Config) Report(level string) {}
|
||||
|
||||
Reference in New Issue
Block a user