From aaf852198471ee8cd9a710dc56162f73f83bd709 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 4 Jul 2023 18:39:00 -0400 Subject: [PATCH] Remplacer struct tags json -> mapstructure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix problèmes de config à s'attendre à du PascalCase au lieu du intended snake_case --- config/config.go | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/config/config.go b/config/config.go index 08f45e5..decfeca 100644 --- a/config/config.go +++ b/config/config.go @@ -16,21 +16,23 @@ obtenues simplement en utilisant la dot (.) notation type Config struct { Server struct { Admin struct { - Auth bool `json:"auth"` - Password string `json:"password"` - Username string `json:"username"` - } `json:"admin"` + Auth bool `mapstructure:"auth"` + Password string `mapstructure:"password"` + Username string `mapstructure:"username"` + } `mapstructure:"admin"` Api struct { - Auth bool `json:"auth"` - Key string `json:"key"` - } `json:"api"` + Auth bool `mapstructure:"auth"` + Key string `mapstructure:"key"` + } `mapstructure:"api"` Documents struct { - AccessKeyId string `json:"access_key_id"` - Buckets []string `json:"buckets"` - Endpoint string `json:"endpoint"` - SecretAccessKey string `json:"secret_access_key"` - UseSSL bool `json:"use_ssl"` - } `json:"documents"` - Port int `json:"port"` - } `json:"server"` + AccessKeyId string `mapstructure:"access_key_id"` + Buckets []string `mapstructure:"buckets"` + Endpoint string `mapstructure:"endpoint"` + SecretAccessKey string `mapstructure:"secret_access_key"` + UseSSL bool `mapstructure:"use_ssl"` + KeyId string `mapstructure:"keyid"` + KeyValue string `mapstructure:"keyvalue"` + } `mapstructure:"documents"` + Port int `mapstructure:"port"` + } `mapstructure:"server"` }