Compare commits

..

1 Commits

4 changed files with 7 additions and 10 deletions

View File

@ -346,7 +346,7 @@ func startPluginManager(ctx context.Context) func() error {
// TODO: Implement some struct tags to map flags to viper // TODO: Implement some struct tags to map flags to viper
func init() { func init() {
cobra.OnInitialize(func() { cobra.OnInitialize(func() {
conf.InitConfig(cfgFile, true) conf.InitConfig(cfgFile)
}) })
rootCmd.PersistentFlags().StringVarP(&cfgFile, "configfile", "c", "", `config file (default "./navidrome.toml")`) rootCmd.PersistentFlags().StringVarP(&cfgFile, "configfile", "c", "", `config file (default "./navidrome.toml")`)

View File

@ -617,7 +617,7 @@ func init() {
setViperDefaults() setViperDefaults()
} }
func InitConfig(cfgFile string, loadEnvVars bool) { func InitConfig(cfgFile string) {
codecRegistry := viper.NewCodecRegistry() codecRegistry := viper.NewCodecRegistry()
_ = codecRegistry.RegisterCodec("ini", ini.Codec{ _ = codecRegistry.RegisterCodec("ini", ini.Codec{
LoadOptions: ini.LoadOptions{ LoadOptions: ini.LoadOptions{
@ -638,12 +638,10 @@ func InitConfig(cfgFile string, loadEnvVars bool) {
} }
_ = viper.BindEnv("port") _ = viper.BindEnv("port")
if loadEnvVars { viper.SetEnvPrefix("ND")
viper.SetEnvPrefix("ND") replacer := strings.NewReplacer(".", "_")
replacer := strings.NewReplacer(".", "_") viper.SetEnvKeyReplacer(replacer)
viper.SetEnvKeyReplacer(replacer) viper.AutomaticEnv()
viper.AutomaticEnv()
}
err := viper.ReadInConfig() err := viper.ReadInConfig()
if viper.ConfigFileUsed() != "" && err != nil { if viper.ConfigFileUsed() != "" && err != nil {

View File

@ -31,7 +31,7 @@ var _ = Describe("Configuration", func() {
filename := filepath.Join("testdata", "cfg."+format) filename := filepath.Join("testdata", "cfg."+format)
// Initialize config with the test file // Initialize config with the test file
conf.InitConfig(filename, false) conf.InitConfig(filename)
// Load the configuration (with noConfigDump=true) // Load the configuration (with noConfigDump=true)
conf.Load(true) conf.Load(true)

View File

@ -53,7 +53,6 @@ const SharePlayer = () => {
remove: false, remove: false,
spaceBar: true, spaceBar: true,
volumeFade: { fadeIn: 200, fadeOut: 200 }, volumeFade: { fadeIn: 200, fadeOut: 200 },
sortableOptions: { delay: 200, delayOnTouchOnly: true },
} }
return ( return (
<ReactJkMusicPlayer <ReactJkMusicPlayer