From 4e5d4d0073df7bffba95107ea969f1fdeb165830 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 1 Dec 2022 17:02:04 +0800 Subject: [PATCH] Skip initing LFS storage if disabled (#21996) A complement to #21985. I overlooked it because the name of the switch is `StartServer`, not `Enabled`. I believe the weird name is a legacy, but renaming is out of scope. --- modules/storage/storage.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/storage/storage.go b/modules/storage/storage.go index 35f1527172381..671e0ce56529e 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -174,6 +174,10 @@ func initAttachments() (err error) { } func initLFS() (err error) { + if !setting.LFS.StartServer { + LFS = discardStorage("LFS isn't enabled") + return nil + } log.Info("Initialising LFS storage with type: %s", setting.LFS.Storage.Type) LFS, err = NewStorage(setting.LFS.Storage.Type, &setting.LFS.Storage) return err