blob: c33cbbf60d1ba350b03d71125a5e5ca09a54a92a (
plain)
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
|
package main
import (
"flag"
"log"
"os"
"git.adyxax.org/adyxax/trains/internal/webui"
"git.adyxax.org/adyxax/trains/pkg/config"
"git.adyxax.org/adyxax/trains/pkg/database"
)
func main() {
path := flag.String("c", os.Getenv("HOME")+"/.config/trains/config.yaml", "configuration file path")
help := flag.Bool("h", false, "display this help message")
flag.Parse()
if *help {
flag.Usage()
os.Exit(0)
}
c, err := config.LoadFile(*path)
if err != nil {
log.Fatal(err)
}
db, err := database.InitDB("sqlite3", "file:test.db?_foreign_keys=on")
if err != nil {
log.Fatal(err)
}
if err := db.Migrate(); err != nil {
log.Fatal(err)
}
webui.Run(c, db)
}
|