waveterm/pkg/wconfig/settingsconfig.go
Sylvie Crowe 21fa9a601f
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.
2024-06-19 23:59:41 -07:00

41 lines
863 B
Go

package wconfig
import (
"path/filepath"
"github.com/wavetermdev/thenextwave/pkg/wavebase"
"github.com/wavetermdev/thenextwave/pkg/wstore"
)
const settingsFile = "settings.json"
var settingsAbsPath = filepath.Join(configDirAbsPath, settingsFile)
type WidgetsConfigType struct {
Icon string `json:"icon"`
BlockDef wstore.BlockDef `json:"blockdef"`
}
type SettingsConfigType struct {
Widgets []WidgetsConfigType `json:"widgets"`
}
func getSettingsConfigDefaults() SettingsConfigType {
return SettingsConfigType{
Widgets: []WidgetsConfigType{
{
Icon: "fa fa-solid fa-files fa-fw",
BlockDef: wstore.BlockDef{
View: "preview",
Meta: map[string]any{"file": wavebase.GetHomeDir()},
},
},
{
Icon: "fa fa-solid fa-chart-simple fa-fw",
BlockDef: wstore.BlockDef{
View: "plot",
},
},
},
}
}