Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit dbaf4d3

Browse files
armonmitchellh
authored andcommitted
remote: Standardize config names
1 parent de8ff3b commit dbaf4d3

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

remote/atlas.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func NewAtlasRemoteClient(conf map[string]string) (*AtlasRemoteClient, error) {
3636
}
3737

3838
func (c *AtlasRemoteClient) validateConfig(conf map[string]string) error {
39-
server, ok := conf["server"]
39+
server, ok := conf["address"]
4040
if !ok || server == "" {
4141
server = defaultAtlasServer
4242
}

remote/consul.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func NewConsulRemoteClient(conf map[string]string) (*ConsulRemoteClient, error)
2424

2525
func (c *ConsulRemoteClient) validateConfig(conf map[string]string) (err error) {
2626
config := consulapi.DefaultConfig()
27-
if token, ok := conf["token"]; ok && token != "" {
27+
if token, ok := conf["access_token"]; ok && token != "" {
2828
config.Token = token
2929
}
3030
if addr, ok := conf["address"]; ok && addr != "" {

remote/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ func NewHTTPRemoteClient(conf map[string]string) (*HTTPRemoteClient, error) {
2626
}
2727

2828
func (c *HTTPRemoteClient) validateConfig(conf map[string]string) error {
29-
urlRaw, ok := conf["url"]
29+
urlRaw, ok := conf["address"]
3030
if !ok || urlRaw == "" {
31-
return fmt.Errorf("missing 'url' configuration")
31+
return fmt.Errorf("missing 'address' configuration")
3232
}
3333
url, err := url.Parse(urlRaw)
3434
if err != nil {

remote/http_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ func TestHTTPRemote_Validate(t *testing.T) {
2525
t.Fatalf("expect error")
2626
}
2727

28-
conf["url"] = ""
28+
conf["address"] = ""
2929
if _, err := NewHTTPRemoteClient(conf); err == nil {
3030
t.Fatalf("expect error")
3131
}
3232

33-
conf["url"] = "*"
33+
conf["address"] = "*"
3434
if _, err := NewHTTPRemoteClient(conf); err == nil {
3535
t.Fatalf("expect error")
3636
}
3737

38-
conf["url"] = "http://cool.com"
38+
conf["address"] = "http://cool.com"
3939
if _, err := NewHTTPRemoteClient(conf); err != nil {
4040
t.Fatalf("err: %v", err)
4141
}
@@ -90,7 +90,7 @@ func TestHTTPRemote_GetState(t *testing.T) {
9090
remote := &terraform.RemoteState{
9191
Type: "http",
9292
Config: map[string]string{
93-
"url": s.URL,
93+
"address": s.URL,
9494
},
9595
}
9696
r, err := NewClientByState(remote)
@@ -231,7 +231,7 @@ func TestHTTPRemote_PutState(t *testing.T) {
231231
remote := &terraform.RemoteState{
232232
Type: "http",
233233
Config: map[string]string{
234-
"url": s.URL + "/foobar",
234+
"address": s.URL + "/foobar",
235235
},
236236
}
237237
r, err := NewClientByState(remote)
@@ -311,7 +311,7 @@ func TestHTTPRemote_DeleteState(t *testing.T) {
311311
remote := &terraform.RemoteState{
312312
Type: "http",
313313
Config: map[string]string{
314-
"url": s.URL + "/foobar",
314+
"address": s.URL + "/foobar",
315315
},
316316
}
317317
r, err := NewClientByState(remote)

remote/remote_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func TestBlankState(t *testing.T) {
306306
remote := &terraform.RemoteState{
307307
Type: "http",
308308
Config: map[string]string{
309-
"url": "http://foo.com/",
309+
"address": "http://foo.com/",
310310
},
311311
}
312312
r, err := blankState(remote)
@@ -335,7 +335,7 @@ func TestPersist(t *testing.T) {
335335
remote := &terraform.RemoteState{
336336
Type: "http",
337337
Config: map[string]string{
338-
"url": "http://foo.com/",
338+
"address": "http://foo.com/",
339339
},
340340
}
341341
blank, _ := blankState(remote)
@@ -396,7 +396,7 @@ func testRemote(t *testing.T, s *terraform.State) (*terraform.RemoteState, *http
396396
remote := &terraform.RemoteState{
397397
Type: "http",
398398
Config: map[string]string{
399-
"url": srv.URL,
399+
"address": srv.URL,
400400
},
401401
}
402402
return remote, srv
@@ -412,7 +412,7 @@ func testRemotePush(t *testing.T, c int) (*terraform.RemoteState, *httptest.Serv
412412
remote := &terraform.RemoteState{
413413
Type: "http",
414414
Config: map[string]string{
415-
"url": srv.URL,
415+
"address": srv.URL,
416416
},
417417
}
418418
return remote, srv

0 commit comments

Comments
 (0)