Make persistence provider pluggable at runtime

This commit is contained in:
Deluan
2020-01-11 14:58:46 -05:00
committed by Deluan Quintão
parent 93ab4132fe
commit 4b1c909a4d
7 changed files with 149 additions and 26 deletions
+5 -2
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/cloudsonic/sonic-server/conf"
"github.com/cloudsonic/sonic-server/persistence"
)
func main() {
@@ -11,7 +12,9 @@ func main() {
fmt.Printf("\nCloudSonic Server v%s\n\n", "0.2")
a := createApp(conf.Sonic.MusicFolder)
a.MountRouter("/rest/", initRouter())
provider := persistence.ProviderIdentifier(conf.Sonic.DevPersistenceProvider)
a := CreateApp(conf.Sonic.MusicFolder, provider)
a.MountRouter("/rest/", CreateSubsonicAPIRouter(provider))
a.Run(":" + conf.Sonic.Port)
}