Merge branch 'main' into feature/bots

This commit is contained in:
Jason Song
2022-12-01 13:39:47 +08:00
committed by GitHub
6 changed files with 168 additions and 81 deletions

View File

@ -110,24 +110,24 @@ func SaveFrom(objStorage ObjectStorage, p string, callback func(w io.Writer) err
var (
// Attachments represents attachments storage
Attachments ObjectStorage
Attachments ObjectStorage = uninitializedStorage
// LFS represents lfs storage
LFS ObjectStorage
LFS ObjectStorage = uninitializedStorage
// Avatars represents user avatars storage
Avatars ObjectStorage
Avatars ObjectStorage = uninitializedStorage
// RepoAvatars represents repository avatars storage
RepoAvatars ObjectStorage
RepoAvatars ObjectStorage = uninitializedStorage
// RepoArchives represents repository archives storage
RepoArchives ObjectStorage
RepoArchives ObjectStorage = uninitializedStorage
// Packages represents packages storage
Packages ObjectStorage
Packages ObjectStorage = uninitializedStorage
// Bots represents bots storage
Bots ObjectStorage
Bots ObjectStorage = uninitializedStorage
)
// Init init the stoarge
@ -168,6 +168,10 @@ func initAvatars() (err error) {
}
func initAttachments() (err error) {
if !setting.Attachment.Enabled {
Attachments = discardStorage("Attachment isn't enabled")
return nil
}
log.Info("Initialising Attachment storage with type: %s", setting.Attachment.Storage.Type)
Attachments, err = NewStorage(setting.Attachment.Storage.Type, &setting.Attachment.Storage)
return err
@ -192,6 +196,10 @@ func initRepoArchives() (err error) {
}
func initPackages() (err error) {
if !setting.Packages.Enabled {
Packages = discardStorage("Packages isn't enabled")
return nil
}
log.Info("Initialising Packages storage with type: %s", setting.Packages.Storage.Type)
Packages, err = NewStorage(setting.Packages.Storage.Type, &setting.Packages.Storage)
return err