diff options
author | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-04-18 16:38:20 -0700 |
---|---|---|
committer | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-04-19 15:48:48 -0700 |
commit | 42f8f006ab01692d7de9cecc06521eaf58743c0d (patch) | |
tree | 03bc5fe0dd662cec4c36e2b67da84cfd30602950 /src/k8splugin/internal/db | |
parent | 5414c23063815207c68bfc7398561cec7409c963 (diff) |
Move configuration into config files
Move k8splugin configuration into config files
instead of using environment variables.
Issue-ID: MULTICLOUD-579
Change-Id: I7b76d5a14d24f002a8db484097a31fb5e908b6f8
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/internal/db')
-rw-r--r-- | src/k8splugin/internal/db/consul.go | 4 | ||||
-rw-r--r-- | src/k8splugin/internal/db/mongo.go | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/k8splugin/internal/db/consul.go b/src/k8splugin/internal/db/consul.go index 0977cfba..40028c64 100644 --- a/src/k8splugin/internal/db/consul.go +++ b/src/k8splugin/internal/db/consul.go @@ -14,7 +14,7 @@ limitations under the License. package db import ( - "os" + k8sconfig "k8splugin/internal/config" "github.com/hashicorp/consul/api" pkgerrors "github.com/pkg/errors" @@ -38,7 +38,7 @@ type ConsulStore struct { func NewConsulStore(store ConsulKVStore) (Store, error) { if store == nil { config := api.DefaultConfig() - config.Address = os.Getenv("DATABASE_IP") + ":8500" + config.Address = k8sconfig.GetConfiguration().DatabaseAddress + ":8500" consulClient, err := api.NewClient(config) if err != nil { diff --git a/src/k8splugin/internal/db/mongo.go b/src/k8splugin/internal/db/mongo.go index a9e9d98a..d4525222 100644 --- a/src/k8splugin/internal/db/mongo.go +++ b/src/k8splugin/internal/db/mongo.go @@ -19,7 +19,8 @@ package db import ( "golang.org/x/net/context" "log" - "os" + + "k8splugin/internal/config" pkgerrors "github.com/pkg/errors" "go.mongodb.org/mongo-driver/bson" @@ -76,7 +77,7 @@ var cursorClose = func(ctx context.Context, cursor *mongo.Cursor) error { // If a database with that name exists, it will be returned func NewMongoStore(name string, store *mongo.Database) (Store, error) { if store == nil { - ip := "mongodb://" + os.Getenv("DATABASE_IP") + ":27017" + ip := "mongodb://" + config.GetConfiguration().DatabaseAddress + ":27017" clientOptions := options.Client() clientOptions.ApplyURI(ip) mongoClient, err := mongo.NewClient(clientOptions) |