From 17e1d2a005a0433dbd5cbfbf8cf5ecd3844f6e1a Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 26 Oct 2016 19:47:31 -0700 Subject: [PATCH] Revert "json-backend: initial pass of json backend" This reverts commit e3ff5159d812416d3598706f8da788de67879ab2. --- backends/client.go | 3 --- backends/config.go | 1 - backends/json/client.go | 45 ----------------------------------------- 3 files changed, 49 deletions(-) delete mode 100644 backends/json/client.go diff --git a/backends/client.go b/backends/client.go index 0bda8a55a..eb081e8a5 100644 --- a/backends/client.go +++ b/backends/client.go @@ -10,7 +10,6 @@ import ( "github.com/kelseyhightower/confd/backends/etcd" "github.com/kelseyhightower/confd/backends/etcdv3" "github.com/kelseyhightower/confd/backends/file" - "github.com/kelseyhightower/confd/backends/json" "github.com/kelseyhightower/confd/backends/metad" "github.com/kelseyhightower/confd/backends/rancher" "github.com/kelseyhightower/confd/backends/redis" @@ -61,8 +60,6 @@ func New(config Config) (StoreClient, error) { return env.NewEnvClient() case "file": return file.NewFileClient(config.YAMLFile) - case "json": - return json.NewJsonClient(config.FilePath) case "vault": vaultConfig := map[string]string{ "app-id": config.AppID, diff --git a/backends/config.go b/backends/config.go index 79e094c05..71b122c19 100644 --- a/backends/config.go +++ b/backends/config.go @@ -16,5 +16,4 @@ type Config struct { AppID string UserID string YAMLFile string - FilePath string } diff --git a/backends/json/client.go b/backends/json/client.go deleted file mode 100644 index 30039f764..000000000 --- a/backends/json/client.go +++ /dev/null @@ -1,45 +0,0 @@ -package json - -import ( - "encoding/json" - "io/ioutil" -) - -// Client provides a shell for the json client -type Client struct { - data map[string]interface{} -} - -// NewJsonClient returns a new client -func NewJsonClient(filePath string) (*Client, error) { - var allJsonVars map[string]interface{} - - fileContents, err := ioutil.ReadFile(filePath) - if err != nil { - return &Client{allJsonVars}, err - } - - err = json.Unmarshal(fileContents, allJsonVars) - if err != nil { - return &Client{allJsonVars}, err - } - - return &Client{allJsonVars}, nil -} - -// GetValues queries the json for keys -func (c *Client) GetValues(keys []string) (map[string]string, error) { - - vars := make(map[string]string) - - for _, key := range keys { - vars[key] = c.data[key].(string) - } - - return vars, nil -} - -func (c *Client) WatchPrefix(prefix string, keys []string, waitIndex uint64, stopChan chan bool) (uint64, error) { - <-stopChan - return 0, nil -}