@@ -30,7 +30,7 @@ func TestReadConfig(t *testing.T) {
3030
3131 tests := []struct {
3232 name string
33- fileContents map [ string ] any
33+ fileContents * configFromFile
3434 envToken string
3535 envFooHeader string
3636 envHeaders string
@@ -52,10 +52,10 @@ func TestReadConfig(t *testing.T) {
5252 },
5353 {
5454 name : "config file, no overrides, trim slash" ,
55- fileContents : map [ string ] any {
56- "endpoint" : "https://example.com/" ,
57- "accessToken" : "deadbeef" ,
58- "proxy" : "https://proxy.com:8080" ,
55+ fileContents : & configFromFile {
56+ Endpoint : "https://example.com/" ,
57+ AccessToken : "deadbeef" ,
58+ Proxy : "https://proxy.com:8080" ,
5959 },
6060 want : & config {
6161 endpointURL : & url.URL {
@@ -73,30 +73,30 @@ func TestReadConfig(t *testing.T) {
7373 },
7474 {
7575 name : "config file, token override only" ,
76- fileContents : map [ string ] any {
77- "endpoint" : "https://example.com/" ,
78- "accessToken" : "deadbeef" ,
76+ fileContents : & configFromFile {
77+ Endpoint : "https://example.com/" ,
78+ AccessToken : "deadbeef" ,
7979 },
8080 envToken : "abc" ,
8181 want : nil ,
8282 wantErr : errConfigMerge .Error (),
8383 },
8484 {
8585 name : "config file, endpoint override only" ,
86- fileContents : map [ string ] any {
87- "endpoint" : "https://example.com/" ,
88- "accessToken" : "deadbeef" ,
86+ fileContents : & configFromFile {
87+ Endpoint : "https://example.com/" ,
88+ AccessToken : "deadbeef" ,
8989 },
9090 envEndpoint : "https://exmaple2.com" ,
9191 want : nil ,
9292 wantErr : errConfigMerge .Error (),
9393 },
9494 {
9595 name : "config file, proxy override only (allow)" ,
96- fileContents : map [ string ] any {
97- "endpoint" : "https://example.com/" ,
98- "accessToken" : "deadbeef" ,
99- "proxy" : "https://proxy.com:8080" ,
96+ fileContents : & configFromFile {
97+ Endpoint : "https://example.com/" ,
98+ AccessToken : "deadbeef" ,
99+ Proxy : "https://proxy.com:8080" ,
100100 },
101101 envProxy : "socks5://other.proxy.com:9999" ,
102102 want : & config {
@@ -115,10 +115,10 @@ func TestReadConfig(t *testing.T) {
115115 },
116116 {
117117 name : "config file, all override" ,
118- fileContents : map [ string ] any {
119- "endpoint" : "https://example.com/" ,
120- "accessToken" : "deadbeef" ,
121- "proxy" : "https://proxy.com:8080" ,
118+ fileContents : & configFromFile {
119+ Endpoint : "https://example.com/" ,
120+ AccessToken : "deadbeef" ,
121+ Proxy : "https://proxy.com:8080" ,
122122 },
123123 envToken : "abc" ,
124124 envEndpoint : "https://override.com" ,
@@ -258,10 +258,10 @@ func TestReadConfig(t *testing.T) {
258258 {
259259 name : "endpoint flag should override config" ,
260260 flagEndpoint : "https://override.com/" ,
261- fileContents : map [ string ] any {
262- "endpoint" : "https://example.com/" ,
263- "accessToken" : "deadbeef" ,
264- "additionalHeaders" : map [string ]string {},
261+ fileContents : & configFromFile {
262+ Endpoint : "https://example.com/" ,
263+ AccessToken : "deadbeef" ,
264+ AdditionalHeaders : map [string ]string {},
265265 },
266266 want : & config {
267267 endpointURL : & url.URL {
0 commit comments