-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (44 loc) · 1.24 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"os"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"github.com/otto-torino/f8a/components"
"github.com/otto-torino/f8a/db"
"github.com/otto-torino/f8a/logger"
"github.com/otto-torino/f8a/theme"
"github.com/spf13/viper"
)
func init() {
// Read settings
viper.SetConfigFile(fmt.Sprintf("/etc/f8a.json"))
if err := viper.ReadInConfig(); err != nil {
panic(fmt.Sprintf("Error reading settings file, %s", err))
}
// Ensure app home directory exists
homePath := viper.GetString("app.homePath")
err := os.MkdirAll(homePath, os.ModePerm)
if err != nil {
panic("Error creating the application home directory")
}
// Init logger
logger.InitLogger()
logger.ZapLog.Info("Starting F8A application")
}
func main() {
// Init database
db.InitDatabase()
a := app.NewWithID("io.otto-torino.f8a")
w := a.NewWindow("Otto Frontend Apps Manager")
a.Settings().SetTheme(&theme.F8aTheme{})
w.SetMainMenu(components.MakeMenu(a, w))
mainContent := components.MakeMainContent()
sidebar := components.MakeSidebar(components.HandleAddWebApp)
mainLayout := container.NewHSplit(sidebar, mainContent)
mainLayout.Offset = 0.3
w.SetContent(mainLayout)
w.Resize(fyne.NewSize(640, 460))
w.ShowAndRun()
}