Browse Source

Add tags for json serialization to settings structs

feature/update-route-registration
Fabian Vowie 3 years ago
parent
commit
6f72597699
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 10
      settings/settings.go
  2. 4
      settings/settings_test.go

10
settings/settings.go

@ -15,14 +15,14 @@ const (
type FileSystemType int
type Settings struct {
Endpoint string
Token string
StorageProvider StorageSettings
Endpoint string `json:"endpoint"`
Token string `json:"token"`
StorageProvider StorageSettings `json:"storage_provider"`
}
type StorageSettings struct {
Type FileSystemType
BasePath string
Type FileSystemType `json:"type"`
BasePath string `json:"base_path"`
}
func parseSettings(data []byte) Settings {

4
settings/settings_test.go

@ -13,9 +13,9 @@ func TestSettingsParsing(t *testing.T) {
const file string = `{
"endpoint": "0.0.0.0:8000",
"token": "foobar",
"storageProvider": {
"storage_provider": {
"type": 0,
"basePath": "assets"
"base_path": "assets"
}
}`

Loading…
Cancel
Save