Is there a package that makes handling application settings easier (or less repetitive)? I am thinking about something like this (pseudo code):
setting := NewJSONSettings('/home/user/setting.json')
setting.AddSettingsCategory('database-connection')
setting.AddSetting('database-connection','server','192.168.1.1')
setting.AddSetting('database-connection','username','me')
setting.AddSetting('database-connection','password','mypassword')
setting.AddSettingsCategory('preferences')
setting.AddSetting('preferences','dark-theme','true')
err:=setting.Save()
And then for loading, maybe something like:
settings := Settings.Load('home/user/settings.json')
fmt.Println(settings.preferences.dark-theme)
What I want is just to hide all the “complexity” involved in creating the json file and structs and all that. And I guess it’s not that complex code, just repetitive if you are writing many small applications. Is there a package for something like this?