summaryrefslogtreecommitdiff
path: root/system/db/init.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-01-10 14:01:24 -0800
committerSteve Manuel <nilslice@gmail.com>2017-01-10 14:01:24 -0800
commitf2908a6b3a602394385c7b5bf5014085361549da (patch)
tree6fc71d8e3e185268814aca4bf12193282c586a41 /system/db/init.go
parent3cc514f8d3a58e01ddc6f19fe39c434a91ac501e (diff)
adding test for store value before attempt to open db
Diffstat (limited to 'system/db/init.go')
-rw-r--r--system/db/init.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/system/db/init.go b/system/db/init.go
index 3d49212..ff2926c 100644
--- a/system/db/init.go
+++ b/system/db/init.go
@@ -26,6 +26,11 @@ func Close() {
// Init creates a db connection, initializes db with required info, sets secrets
func Init() {
fmt.Println("db.Init inside db package")
+ if store != nil {
+ fmt.Println("db.Init already intialized store")
+ return
+ }
+
var err error
store, err = bolt.Open("system.db", 0666, nil)
if err != nil {