mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
* feat(config): Add EnforceNonRootUser config option to exit early if started as root Signed-off-by: Aengus Walton <ventolin@gmail.com> * Move validateEnforceNonRootUser check to directly after parsing the config * Ensure the data directory hasn't been created in test --------- Signed-off-by: Aengus Walton <ventolin@gmail.com> Co-authored-by: Deluan Quintão <deluan@navidrome.org>
35 lines
681 B
Go
35 lines
681 B
Go
package conf
|
|
|
|
func ResetConf() {
|
|
Server = &configOptions{}
|
|
}
|
|
|
|
var SetViperDefaults = setViperDefaults
|
|
|
|
var ParseLanguages = parseLanguages
|
|
|
|
var ValidateURL = validateURL
|
|
|
|
var NormalizeSearchBackend = normalizeSearchBackend
|
|
|
|
var ToPascalCase = toPascalCase
|
|
|
|
var ValidateMaxImageUploadSize = validateMaxImageUploadSize
|
|
|
|
func SetRuntimeInfoForTest(goos string, euid int) func() {
|
|
oldGOOS := currentGOOS
|
|
oldEUID := getEUID
|
|
currentGOOS = func() string { return goos }
|
|
getEUID = func() int { return euid }
|
|
return func() {
|
|
currentGOOS = oldGOOS
|
|
getEUID = oldEUID
|
|
}
|
|
}
|
|
|
|
func SetLogFatal(f func(...any)) func() {
|
|
old := logFatal
|
|
logFatal = f
|
|
return func() { logFatal = old }
|
|
}
|