gogmagog/main.go
Deepak da50161a92
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
Makes config testable
2020-12-28 16:30:10 -06:00

48 lines
846 B
Go

package main
import (
"gitea.deepak.science/deepak/gogmagog/config"
"gitea.deepak.science/deepak/gogmagog/db"
"gitea.deepak.science/deepak/gogmagog/models"
"log"
)
func main() {
// Config
conf := config.GetConf("config")
appConf := conf.App
port := appConf.Port
env := appConf.Environment
log.Print("Running server on " + port)
log.Print("App environment is " + env)
// DB
store := db.GetStore(&conf.Db)
if store != nil {
log.Print("Got DB connection")
}
m := models.New(store)
if m != nil {
log.Print("created model")
}
acts, acterr := m.Actions()
if acterr != nil {
log.Fatal("whoopsies", acterr)
} else {
log.Printf("Got %d actions", len(acts))
for i, act := range acts {
log.Printf("%d: %v", i, act)
}
}
}
// Hello is method here to be testable.
func Hello() string {
return "Hello, world!\n"
}