feat(config): subsonic.allow_plaintext_password
This commit is contained in:
@@ -15,6 +15,7 @@ type Config struct {
|
|||||||
Log LogConfig `yaml:"log"`
|
Log LogConfig `yaml:"log"`
|
||||||
Auth AuthConfig `yaml:"auth"`
|
Auth AuthConfig `yaml:"auth"`
|
||||||
Library LibraryConfig `yaml:"library"`
|
Library LibraryConfig `yaml:"library"`
|
||||||
|
Subsonic SubsonicConfig `yaml:"subsonic"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
@@ -47,6 +48,13 @@ type LibraryConfig struct {
|
|||||||
ScanOnStartup bool `yaml:"scan_on_startup"`
|
ScanOnStartup bool `yaml:"scan_on_startup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubsonicConfig controls wire-format concessions on the /rest/* surface.
|
||||||
|
// AllowPlaintextPassword gates the `p=` parameter; the recommended posture is
|
||||||
|
// to leave it disabled and require apiKey (OpenSubsonic) or t+s.
|
||||||
|
type SubsonicConfig struct {
|
||||||
|
AllowPlaintextPassword bool `yaml:"allow_plaintext_password"`
|
||||||
|
}
|
||||||
|
|
||||||
func Default() Config {
|
func Default() Config {
|
||||||
return Config{
|
return Config{
|
||||||
Server: ServerConfig{Address: ":4533"},
|
Server: ServerConfig{Address: ":4533"},
|
||||||
@@ -98,6 +106,11 @@ func applyEnv(cfg *Config) {
|
|||||||
cfg.Library.ScanOnStartup = b
|
cfg.Library.ScanOnStartup = b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if v, ok := os.LookupEnv("SMARTMUSIC_SUBSONIC_ALLOW_PLAINTEXT_PASSWORD"); ok {
|
||||||
|
if b, err := strconv.ParseBool(v); err == nil {
|
||||||
|
cfg.Subsonic.AllowPlaintextPassword = b
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// splitPaths splits a colon-separated path list, dropping empty entries.
|
// splitPaths splits a colon-separated path list, dropping empty entries.
|
||||||
|
|||||||
Reference in New Issue
Block a user