summaryrefslogtreecommitdiff
path: root/system/db/addon.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-01-10 12:42:26 -0800
committerSteve Manuel <nilslice@gmail.com>2017-01-10 12:42:26 -0800
commit2c4046d2eb2204cf8bbaf49167abdefb11034e84 (patch)
tree807baca9c471d513fc5054287626e05eb3cc8e36 /system/db/addon.go
parent4415d2e915fda066a4ee092dc51311edc2e74100 (diff)
adding Init check in func called early in process
Diffstat (limited to 'system/db/addon.go')
-rw-r--r--system/db/addon.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/system/db/addon.go b/system/db/addon.go
index b5c4929..8ad071d 100644
--- a/system/db/addon.go
+++ b/system/db/addon.go
@@ -15,12 +15,6 @@ var (
ErrNoAddonExists = errors.New("No addon exists.")
)
-func init() {
- if store == nil {
- Init()
- }
-}
-
// Addon looks for an addon by its addon_reverse_dns as the key and returns
// the url.Values representation of an addon
func Addon(key string) (url.Values, error) {
@@ -143,6 +137,11 @@ func DeleteAddon(key string) error {
// value at addon_reverse_dns
func AddonExists(key string) bool {
var exists bool
+
+ if store == nil {
+ Init()
+ }
+
err := store.Update(func(tx *bolt.Tx) error {
b, err := tx.CreateBucketIfNotExists([]byte("__addons"))
if err != nil {