Make DisableAuthentication a Dev flag
This commit is contained in:
parent
408030eb6c
commit
5acc9c7a22
4 changed files with 7 additions and 7 deletions
|
|
@ -42,7 +42,7 @@ func (api *Router) Routes() http.Handler {
|
||||||
r.Use(checkRequiredParameters)
|
r.Use(checkRequiredParameters)
|
||||||
|
|
||||||
// Add validation middleware if not disabled
|
// Add validation middleware if not disabled
|
||||||
if !conf.Sonic.DisableAuthentication {
|
if !conf.Sonic.DevDisableAuthentication {
|
||||||
r.Use(authenticate)
|
r.Use(authenticate)
|
||||||
// TODO Validate version
|
// TODO Validate version
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ var _ = Describe("Middlewares", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
conf.Sonic.User = "admin"
|
conf.Sonic.User = "admin"
|
||||||
conf.Sonic.Password = "wordpass"
|
conf.Sonic.Password = "wordpass"
|
||||||
conf.Sonic.DisableAuthentication = false
|
conf.Sonic.DevDisableAuthentication = false
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("Plaintext password", func() {
|
Context("Plaintext password", func() {
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,8 @@ type sonic struct {
|
||||||
IgnoredArticles string `default:"The El La Los Las Le Les Os As O A"`
|
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]([)"`
|
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"`
|
||||||
User string `default:"anyone"`
|
Password string `default:"wordpass"`
|
||||||
Password string `default:"wordpass"`
|
|
||||||
|
|
||||||
DisableDownsampling bool `default:"false"`
|
DisableDownsampling bool `default:"false"`
|
||||||
DownsampleCommand string `default:"ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -"`
|
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;\\~"`
|
PlsIgnoredPatterns string `default:"^iCloud;\\~"`
|
||||||
|
|
||||||
// DevFlags
|
// DevFlags
|
||||||
DevDisableFileCheck bool `default:"false"`
|
DevDisableAuthentication bool `default:"false"`
|
||||||
|
DevDisableFileCheck bool `default:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var Sonic *sonic
|
var Sonic *sonic
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
DisableAuthentication = false
|
DevDisableAuthentication = false
|
||||||
User = "deluan"
|
User = "deluan"
|
||||||
Password = "wordpass"
|
Password = "wordpass"
|
||||||
DbPath = "/tmp/testDb"
|
DbPath = "/tmp/testDb"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue