mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-13 10:47:19 +03:00
Fix startup order, setting LogLevel
This commit is contained in:
parent
1e582bec5c
commit
28cd3ec3e4
@ -41,7 +41,10 @@ func LoadFromEnv() {
|
||||
Sonic.Port = port
|
||||
}
|
||||
l := &multiconfig.EnvironmentLoader{}
|
||||
l.Load(Sonic)
|
||||
err := l.Load(Sonic)
|
||||
if err != nil {
|
||||
log.Error("Error parsing configuration from environment")
|
||||
}
|
||||
}
|
||||
|
||||
func LoadFromTags() {
|
||||
@ -55,7 +58,6 @@ func LoadFromFile(tomlFile string) {
|
||||
if err != nil {
|
||||
log.Error("Error loading configuration file", "file", tomlFile, err)
|
||||
}
|
||||
log.SetLogLevelString(Sonic.LogLevel)
|
||||
}
|
||||
|
||||
func LoadFromLocalFile() {
|
||||
@ -68,6 +70,7 @@ func Load() {
|
||||
LoadFromLocalFile()
|
||||
LoadFromEnv()
|
||||
LoadFromFlags()
|
||||
log.SetLogLevelString(Sonic.LogLevel)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
5
main.go
5
main.go
@ -2,11 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
||||
"github.com/cloudsonic/sonic-server/server"
|
||||
)
|
||||
|
||||
func main() {
|
||||
conf.Load()
|
||||
|
||||
if !conf.Sonic.DevDisableBanner {
|
||||
server.ShowBanner()
|
||||
}
|
||||
|
||||
a := CreateServer(conf.Sonic.MusicFolder)
|
||||
a.MountRouter("/rest", CreateSubsonicAPIRouter())
|
||||
a.MountRouter("/app", CreateAppRouter("/app"))
|
||||
|
@ -14,6 +14,6 @@ Version %s
|
||||
|
||||
`
|
||||
|
||||
func showBanner(version string) {
|
||||
fmt.Printf(banner, version)
|
||||
func ShowBanner() {
|
||||
fmt.Printf(banner, Version)
|
||||
}
|
||||
|
@ -25,9 +25,6 @@ type Server struct {
|
||||
|
||||
func New(scanner *scanner.Scanner, ds model.DataStore) *Server {
|
||||
a := &Server{Scanner: scanner, ds: ds}
|
||||
if !conf.Sonic.DevDisableBanner {
|
||||
showBanner(Version)
|
||||
}
|
||||
initMimeTypes()
|
||||
initialSetup(ds)
|
||||
a.initRoutes()
|
||||
|
Loading…
x
Reference in New Issue
Block a user