feat: tranfer log to storage

This commit is contained in:
Jason Song
2022-10-19 15:49:23 +08:00
parent d2f8d5ded1
commit 8dbe30dff9
8 changed files with 129 additions and 46 deletions

View File

@ -126,31 +126,27 @@ var (
// Packages represents packages storage
Packages ObjectStorage
// Builds represents builds storage
Builds ObjectStorage
)
// Init init the stoarge
func Init() error {
if err := initAttachments(); err != nil {
return err
for _, f := range []func() error{
initAttachments,
initAvatars,
initRepoAvatars,
initLFS,
initRepoArchives,
initPackages,
initBuilds,
} {
if err := f(); err != nil {
return err
}
}
if err := initAvatars(); err != nil {
return err
}
if err := initRepoAvatars(); err != nil {
return err
}
if err := initLFS(); err != nil {
return err
}
if err := initRepoArchives(); err != nil {
return err
}
return initPackages()
return nil
}
// NewStorage takes a storage type and some config and returns an ObjectStorage or an error
@ -201,3 +197,9 @@ func initPackages() (err error) {
Packages, err = NewStorage(setting.Packages.Storage.Type, &setting.Packages.Storage)
return err
}
func initBuilds() (err error) {
log.Info("Initialising Builds storage with type: %s", setting.Builds.Storage.Type)
Builds, err = NewStorage(setting.Builds.Storage.Type, &setting.Builds.Storage)
return err
}