Add cache block list for extensions not to cache

This commit is contained in:
Ingo Oppermann
2022-08-02 19:10:28 +02:00
parent 6af226aea7
commit 273ca0abbc
12 changed files with 760 additions and 250 deletions

View File

@@ -154,11 +154,6 @@ func (a *api) Reload() error {
}
cfg := store.Get()
if err := cfg.Migrate(); err == nil {
store.Set(cfg)
} else {
return err
}
cfg.Merge()
@@ -631,11 +626,12 @@ func (a *api) start() error {
if cfg.Storage.Disk.Cache.Enable {
diskCache, err := cache.NewLRUCache(cache.LRUConfig{
TTL: time.Duration(cfg.Storage.Disk.Cache.TTL) * time.Second,
MaxSize: cfg.Storage.Disk.Cache.Size * 1024 * 1024,
MaxFileSize: cfg.Storage.Disk.Cache.FileSize * 1024 * 1024,
Extensions: cfg.Storage.Disk.Cache.Types,
Logger: a.log.logger.core.WithComponent("HTTPCache"),
TTL: time.Duration(cfg.Storage.Disk.Cache.TTL) * time.Second,
MaxSize: cfg.Storage.Disk.Cache.Size * 1024 * 1024,
MaxFileSize: cfg.Storage.Disk.Cache.FileSize * 1024 * 1024,
AllowExtensions: cfg.Storage.Disk.Cache.Types.Allow,
BlockExtensions: cfg.Storage.Disk.Cache.Types.Block,
Logger: a.log.logger.core.WithComponent("HTTPCache"),
})
if err != nil {

View File

@@ -33,7 +33,6 @@ func doImport(logger log.Logger, configstore config.Store) error {
logger.Info().Log("Database import")
cfg := configstore.Get()
cfg.Migrate()
// Merging the persisted config with the environment variables
cfg.Merge()
@@ -117,7 +116,6 @@ func doImport(logger log.Logger, configstore config.Store) error {
// Get the unmerged config for persisting
cfg = configstore.Get()
cfg.Migrate()
// Add static routes to mimic the old URLs
cfg.Router.Routes["/hls/live.stream.m3u8"] = "/memfs/" + importConfig.id + ".m3u8"

View File

@@ -11,8 +11,6 @@ func TestImport(t *testing.T) {
configstore := config.NewDummyStore()
cfg := configstore.Get()
cfg.Version = 1
cfg.Migrate()
err := configstore.Set(cfg)
require.NoError(t, err)

View File

@@ -29,8 +29,8 @@ func (v versionInfo) MinorString() string {
// Version of the app
var Version = versionInfo{
Major: 16,
Minor: 9,
Patch: 1,
Minor: 10,
Patch: 0,
}
// Commit is the git commit the app is build from. It should be filled in during compilation