remote: Standardize config names

This commit is contained in:
Armon Dadgar 2014-12-04 18:48:48 -08:00 committed by Mitchell Hashimoto
parent de8ff3b981
commit dbaf4d3f2a
5 changed files with 14 additions and 14 deletions

View File

@ -36,7 +36,7 @@ func NewAtlasRemoteClient(conf map[string]string) (*AtlasRemoteClient, error) {
}
func (c *AtlasRemoteClient) validateConfig(conf map[string]string) error {
server, ok := conf["server"]
server, ok := conf["address"]
if !ok || server == "" {
server = defaultAtlasServer
}

View File

@ -24,7 +24,7 @@ func NewConsulRemoteClient(conf map[string]string) (*ConsulRemoteClient, error)
func (c *ConsulRemoteClient) validateConfig(conf map[string]string) (err error) {
config := consulapi.DefaultConfig()
if token, ok := conf["token"]; ok && token != "" {
if token, ok := conf["access_token"]; ok && token != "" {
config.Token = token
}
if addr, ok := conf["address"]; ok && addr != "" {

View File

@ -26,9 +26,9 @@ func NewHTTPRemoteClient(conf map[string]string) (*HTTPRemoteClient, error) {
}
func (c *HTTPRemoteClient) validateConfig(conf map[string]string) error {
urlRaw, ok := conf["url"]
urlRaw, ok := conf["address"]
if !ok || urlRaw == "" {
return fmt.Errorf("missing 'url' configuration")
return fmt.Errorf("missing 'address' configuration")
}
url, err := url.Parse(urlRaw)
if err != nil {

View File

@ -25,17 +25,17 @@ func TestHTTPRemote_Validate(t *testing.T) {
t.Fatalf("expect error")
}
conf["url"] = ""
conf["address"] = ""
if _, err := NewHTTPRemoteClient(conf); err == nil {
t.Fatalf("expect error")
}
conf["url"] = "*"
conf["address"] = "*"
if _, err := NewHTTPRemoteClient(conf); err == nil {
t.Fatalf("expect error")
}
conf["url"] = "http://cool.com"
conf["address"] = "http://cool.com"
if _, err := NewHTTPRemoteClient(conf); err != nil {
t.Fatalf("err: %v", err)
}
@ -90,7 +90,7 @@ func TestHTTPRemote_GetState(t *testing.T) {
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": s.URL,
"address": s.URL,
},
}
r, err := NewClientByState(remote)
@ -231,7 +231,7 @@ func TestHTTPRemote_PutState(t *testing.T) {
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": s.URL + "/foobar",
"address": s.URL + "/foobar",
},
}
r, err := NewClientByState(remote)
@ -311,7 +311,7 @@ func TestHTTPRemote_DeleteState(t *testing.T) {
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": s.URL + "/foobar",
"address": s.URL + "/foobar",
},
}
r, err := NewClientByState(remote)

View File

@ -306,7 +306,7 @@ func TestBlankState(t *testing.T) {
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": "http://foo.com/",
"address": "http://foo.com/",
},
}
r, err := blankState(remote)
@ -335,7 +335,7 @@ func TestPersist(t *testing.T) {
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": "http://foo.com/",
"address": "http://foo.com/",
},
}
blank, _ := blankState(remote)
@ -396,7 +396,7 @@ func testRemote(t *testing.T, s *terraform.State) (*terraform.RemoteState, *http
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": srv.URL,
"address": srv.URL,
},
}
return remote, srv
@ -412,7 +412,7 @@ func testRemotePush(t *testing.T, c int) (*terraform.RemoteState, *httptest.Serv
remote := &terraform.RemoteState{
Type: "http",
Config: map[string]string{
"url": srv.URL,
"address": srv.URL,
},
}
return remote, srv