Add filewatcher for config files (#63)

This adds the filewatcher and forwards events to the frontend. It also
sets up the widgets as something that can be controlled with a config
file.
This commit is contained in:
Sylvie Crowe
2024-06-19 23:59:41 -07:00
committed by GitHub
parent c7f76d5ced
commit 21fa9a601f
13 changed files with 369 additions and 31 deletions
+16
View File
@@ -15,6 +15,7 @@ import (
"github.com/wavetermdev/thenextwave/pkg/filestore"
"github.com/wavetermdev/thenextwave/pkg/util/utilfn"
"github.com/wavetermdev/thenextwave/pkg/wavebase"
"github.com/wavetermdev/thenextwave/pkg/wconfig"
)
const MaxFileSize = 10 * 1024 * 1024 // 10M
@@ -117,3 +118,18 @@ func (fs *FileService) GetWaveFile(id string, path string) (any, error) {
}
return file, nil
}
func (fs *FileService) GetSettingsConfig() interface{} {
watcher := wconfig.GetWatcher()
return watcher.GetSettingsConfig()
}
func (fs *FileService) AddWidget(newWidget wconfig.WidgetsConfigType) error {
watcher := wconfig.GetWatcher()
return watcher.AddWidget(newWidget)
}
func (fs *FileService) RemoveWidget(idx uint) error {
watcher := wconfig.GetWatcher()
return watcher.RmWidget(idx)
}