feature (dynamic): make configuration dynamic

This commit is contained in:
MickaelK
2024-03-12 23:52:16 +11:00
parent 845c4584d3
commit 9e142d5de5
31 changed files with 631 additions and 542 deletions

View File

@ -32,11 +32,6 @@ var (
)
func init() {
FileCache = NewAppCache()
cachePath := GetAbsolutePath(TMP_PATH)
FileCache.OnEvict(func(key string, value interface{}) {
os.RemoveAll(filepath.Join(cachePath, key))
})
ZipTimeout = func() int {
return Config.Get("features.protection.zip_timeout").Schema(func(f *FormElement) *FormElement {
if f == nil {
@ -50,7 +45,13 @@ func init() {
return f
}).Int()
}
ZipTimeout()
FileCache = NewAppCache()
FileCache.OnEvict(func(key string, value interface{}) {
os.RemoveAll(filepath.Join(GetAbsolutePath(TMP_PATH), key))
})
Hooks.Register.Onload(func() {
ZipTimeout()
})
}
func FileLs(ctx *App, res http.ResponseWriter, req *http.Request) {