2020-06-23 03:11:56 +02:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
2020-10-05 19:07:09 +02:00
|
|
|
"github.com/owncast/owncast/config"
|
|
|
|
"github.com/owncast/owncast/core/playlist"
|
|
|
|
"github.com/owncast/owncast/core/storageproviders"
|
2020-06-23 03:11:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
usingExternalStorage = false
|
|
|
|
)
|
|
|
|
|
|
|
|
func setupStorage() error {
|
2020-07-20 06:15:53 +02:00
|
|
|
if config.Config.S3.Enabled {
|
2020-06-23 03:11:56 +02:00
|
|
|
_storage = &storageproviders.S3Storage{}
|
|
|
|
usingExternalStorage = true
|
|
|
|
}
|
|
|
|
|
|
|
|
if usingExternalStorage {
|
|
|
|
if err := _storage.Setup(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
go playlist.StartVideoContentMonitor(_storage)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|