From 5acc9c7a226cbc7135d9f3ec018939962b9d44d3 Mon Sep 17 00:00:00 2001 From: Deluan Date: Sat, 11 Jan 2020 13:03:31 -0500 Subject: [PATCH] Make DisableAuthentication a Dev flag --- api/api.go | 2 +- api/middlewares_test.go | 2 +- conf/configuration.go | 8 ++++---- tests/sonic-test.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/api.go b/api/api.go index 05d03b903..94403032c 100644 --- a/api/api.go +++ b/api/api.go @@ -42,7 +42,7 @@ func (api *Router) Routes() http.Handler { r.Use(checkRequiredParameters) // Add validation middleware if not disabled - if !conf.Sonic.DisableAuthentication { + if !conf.Sonic.DevDisableAuthentication { r.Use(authenticate) // TODO Validate version } diff --git a/api/middlewares_test.go b/api/middlewares_test.go index f5e733d9e..4bd8dc263 100644 --- a/api/middlewares_test.go +++ b/api/middlewares_test.go @@ -70,7 +70,7 @@ var _ = Describe("Middlewares", func() { BeforeEach(func() { conf.Sonic.User = "admin" conf.Sonic.Password = "wordpass" - conf.Sonic.DisableAuthentication = false + conf.Sonic.DevDisableAuthentication = false }) Context("Plaintext password", func() { diff --git a/conf/configuration.go b/conf/configuration.go index 804689e7c..e54ff3399 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -15,9 +15,8 @@ type sonic struct { IgnoredArticles string `default:"The El La Los Las Le Les Os As O A"` IndexGroups string `default:"A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ) [Unknown]([)"` - DisableAuthentication bool `default:"false"` - User string `default:"anyone"` - Password string `default:"wordpass"` + User string `default:"anyone"` + Password string `default:"wordpass"` DisableDownsampling bool `default:"false"` DownsampleCommand string `default:"ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -"` @@ -25,7 +24,8 @@ type sonic struct { PlsIgnoredPatterns string `default:"^iCloud;\\~"` // DevFlags - DevDisableFileCheck bool `default:"false"` + DevDisableAuthentication bool `default:"false"` + DevDisableFileCheck bool `default:"false"` } var Sonic *sonic diff --git a/tests/sonic-test.toml b/tests/sonic-test.toml index 7ab635c46..aa1140840 100644 --- a/tests/sonic-test.toml +++ b/tests/sonic-test.toml @@ -1,4 +1,4 @@ -DisableAuthentication = false +DevDisableAuthentication = false User = "deluan" Password = "wordpass" DbPath = "/tmp/testDb"