From 6f72597699c16af013e495c03798b49249c568ba Mon Sep 17 00:00:00 2001 From: Fabian Vowie Date: Mon, 17 Jan 2022 17:05:59 +0100 Subject: [PATCH] Add tags for json serialization to settings structs --- settings/settings.go | 10 +++++----- settings/settings_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/settings/settings.go b/settings/settings.go index b0006b1..f6ae397 100644 --- a/settings/settings.go +++ b/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 { diff --git a/settings/settings_test.go b/settings/settings_test.go index 2610eab..30f6908 100644 --- a/settings/settings_test.go +++ b/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" } }`