All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
53 lines
931 B
Go
53 lines
931 B
Go
package main
|
|
|
|
import (
|
|
"gitea.deepak.science/deepak/gogmagog/config"
|
|
"gitea.deepak.science/deepak/gogmagog/db"
|
|
"gitea.deepak.science/deepak/gogmagog/models"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
// Config
|
|
conf, err := config.GetConf("config")
|
|
if err != nil {
|
|
log.Fatal("Could not get config", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
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"
|
|
}
|