New config to disable all external integrations. Closes #102

This commit is contained in:
Deluan 2021-10-30 18:00:32 -04:00
parent 0b5ed9eb80
commit 1823159b25
2 changed files with 16 additions and 0 deletions

View File

@ -29,6 +29,7 @@ type configOptions struct {
UILoginBackgroundURL string
EnableTranscodingConfig bool
EnableDownloads bool
EnableExternalServices bool
TranscodingCacheSize string
ImageCacheSize string
AutoImportPlaylists bool
@ -138,12 +139,24 @@ func Load() {
fmt.Println(prettyConf)
}
if !Server.EnableExternalServices {
disableExternalServices()
}
// Call init hooks
for _, hook := range hooks {
hook()
}
}
func disableExternalServices() {
log.Info("All external integrations are DISABLED!")
Server.LastFM.Enabled = false
Server.Spotify.ID = ""
Server.UILoginBackgroundURL = consts.DefaultUILoginBackgroundURLOffline
Server.DevListenBrainzEnabled = false
}
func validateScanSchedule() error {
if Server.ScanInterval != -1 {
log.Warn("ScanInterval is DEPRECATED. Please use ScanSchedule. See docs at https://navidrome.org/docs/usage/configuration-options/")
@ -195,6 +208,7 @@ func init() {
viper.SetDefault("autoimportplaylists", true)
viper.SetDefault("playlistspath", consts.DefaultPlaylistsPath)
viper.SetDefault("enabledownloads", true)
viper.SetDefault("enableexternalservices", true)
// Config options only valid for file/env configuration
viper.SetDefault("searchfullstring", false)

View File

@ -35,6 +35,8 @@ const (
// Login backgrounds from https://unsplash.com/collections/20072696/navidrome
DefaultUILoginBackgroundURL = "https://source.unsplash.com/collection/20072696/1600x900"
// In case external integrations are disabled
DefaultUILoginBackgroundURLOffline = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAABGdBTUEAALGPC/xhBQAAAiJJREFUeF7t0IEAAAAAw6D5Ux/khVBhwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDDwMDDVlwABBWcSrQAAAABJRU5ErkJggg=="
RequestThrottleBacklogLimit = 100
RequestThrottleBacklogTimeout = time.Minute