Log config when debug-level

This commit is contained in:
2021-09-19 05:49:23 +02:00
parent bc02653473
commit 66aea2f30b
4 changed files with 31 additions and 19 deletions

View File

@@ -9,6 +9,7 @@ import (
"strings"
"github.com/pelletier/go-toml"
"go.uber.org/zap"
)
var ErrNotFound = errors.New("no config file found")
@@ -131,3 +132,12 @@ func FromDefaultLocations() (*Config, error) {
}
return nil, ErrNotFound
}
func (c *Config) DebugLog(logger *zap.SugaredLogger) {
logger.Debugw("Config",
"hostname", c.Hostname,
"rtmp_addr", c.RTMPListenAddr,
"http_enable", c.HTTPListenAddr,
"http_accesslog", c.HTTPAccessLogEnable,
"log_level", c.LogLevel)
}

View File

@@ -122,7 +122,8 @@ func TestConfig(t *testing.T) {
sr := strings.NewReader(emptyCfg)
c, err := config.FromReader(sr)
if err != nil {
if err == nil {
// TODO: Check that it actually returns the correct error
t.Fatalf("Error parsing config string: %s", err)
}
if err := c.UpdateFromEnv(); err == nil {