🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
fix(config): enables quoted `;` as values in ini files
Deluanc21aee736006
diff --git a/conf/configuration.go b/conf/configuration.goindex 0ad81492a..8be005591 100644--- a/conf/configuration.go+++ b/conf/configuration.go@@ -617,7 +617,12 @@ func init() {func InitConfig(cfgFile string) {codecRegistry := viper.NewCodecRegistry()- _ = codecRegistry.RegisterCodec("ini", ini.Codec{})+ _ = codecRegistry.RegisterCodec("ini", ini.Codec{+ LoadOptions: ini.LoadOptions{+ UnescapeValueDoubleQuotes: true,+ UnescapeValueCommentSymbols: true,+ },+ })viper.SetOptions(viper.WithCodecRegistry(codecRegistry))cfgFile = getConfigFile(cfgFile)diff --git a/conf/configuration_test.go b/conf/configuration_test.goindex 5b54e4975..88454d204 100644--- a/conf/configuration_test.go+++ b/conf/configuration_test.go@@ -39,6 +39,7 @@ var _ = Describe("Configuration", func() {Expect(conf.Server.MusicFolder).To(Equal(fmt.Sprintf("/%s/music", format)))Expect(conf.Server.UIWelcomeMessage).To(Equal("Welcome " + format))Expect(conf.Server.Tags["custom"].Aliases).To(Equal([]string{format, "test"}))+ Expect(conf.Server.Tags["artist"].Split).To(Equal([]string{";"}))// The config file used should be the one we createdExpect(conf.Server.ConfigFile).To(Equal(filename))diff --git a/conf/testdata/cfg.ini b/conf/testdata/cfg.iniindex cec7d3c70..e0062ff0e 100644--- a/conf/testdata/cfg.ini+++ b/conf/testdata/cfg.ini@@ -1,6 +1,7 @@[default]MusicFolder = /ini/music-UIWelcomeMessage = Welcome ini+UIWelcomeMessage = 'Welcome ini' ; Just a comment to test the LoadOptions[Tags]-Custom.Aliases = ini,test\ No newline at end of file+Custom.Aliases = ini,test+artist.Split = ";" # Should be able to read ; as a separator\ No newline at end of filediff --git a/conf/testdata/cfg.json b/conf/testdata/cfg.jsonindex 37cf74f08..127103a53 100644--- a/conf/testdata/cfg.json+++ b/conf/testdata/cfg.json@@ -2,6 +2,9 @@"musicFolder": "/json/music","uiWelcomeMessage": "Welcome json","Tags": {+ "artist": {+ "split": ";"+ },"custom": {"aliases": ["json",diff --git a/conf/testdata/cfg.toml b/conf/testdata/cfg.tomlindex 1dc852b18..d94d786e2 100644--- a/conf/testdata/cfg.toml+++ b/conf/testdata/cfg.toml@@ -1,5 +1,7 @@musicFolder = "/toml/music"uiWelcomeMessage = "Welcome toml"+Tags.artist.Split = ';'+[Tags.custom]aliases = ["toml", "test"]diff --git a/conf/testdata/cfg.yaml b/conf/testdata/cfg.yamlindex 38b98d4aa..66e12c4eb 100644--- a/conf/testdata/cfg.yaml+++ b/conf/testdata/cfg.yaml@@ -1,6 +1,8 @@musicFolder: "/yaml/music"uiWelcomeMessage: "Welcome yaml"Tags:+ artist:+ split: [";"]custom:aliases:- yaml