From a29babebd07ecab71034b2db6c59db78d48d7605 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 1 Dec 2022 13:42:48 +0800 Subject: [PATCH] fix: skip initing bots storage if disabled --- modules/storage/storage.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/storage/storage.go b/modules/storage/storage.go index 5a06ff3e46..13eee94d52 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -124,10 +124,10 @@ var ( RepoArchives ObjectStorage = uninitializedStorage // Packages represents packages storage - Packages ObjectStorage = uninitializedStorage + Packages ObjectStorage = uninitializedStorage // Bots represents bots storage - Bots ObjectStorage = uninitializedStorage + Bots ObjectStorage = uninitializedStorage ) // Init init the stoarge @@ -206,6 +206,10 @@ func initPackages() (err error) { } func initBots() (err error) { + if !setting.Bots.Enabled { + Bots = discardStorage("Bots isn't enabled") + return nil + } log.Info("Initialising Bots storage with type: %s", setting.Bots.Storage.Type) Bots, err = NewStorage(setting.Bots.Storage.Type, &setting.Bots.Storage) return err