-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
33 lines (24 loc) · 793 Bytes
/
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
package main
import (
"github.com/user/lePereT/daemon"
)
var assetsPath string
func processFlags() *daemon.Config {
cfg := &daemon.Config{}
flag.StringVar(&cfg.ListenSpec, "listen", "localhost:3000", "HTTP listen spec")
flag.StringVar(&cfg.Db.ConnectString, "db-connect", "host=/var/run/postgresql dbname=gowebapp sslmode=disable", "DB Connect String")
flag.StringVar(&assetsPath, "assets-path", "assets", "Path to assets dir")
flag.Parse()
return cfg
}
func setupHttpAssets(cfg *daemon.Config) {
log.Printf("Assets served from %q.", assetsPath)
cfg.UI.Assets = http.Dir(assetsPath)
}
func main() {
cfg := processFlags()
setupHttpAssets(cfg)
if err := daemon.Run(cfg); err != nil {
log.Printf("Error in main(): %v", err)
}
}