add cmd dir and move templates over

This commit is contained in:
cubixle
2022-08-03 15:29:35 +01:00
parent 6a93d24444
commit 1ad835f11f
6 changed files with 0 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package main
import (
"log"
"os"
"{{resources_pkg}}"
"github.com/labstack/echo/v4"
"github.com/sirupsen/logrus"
"github.com/tuukoti/framework/config"
)
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
cfgPath := getEnv("TUUKOTI_CONFIG", "./config.yml")
cfg, err := config.Load(cfgPath)
if err != nil {
return err
}
log := logrus.New()
e := echo.New()
http.RegisterRoutes(e, log)
return e.Start(cfg.Host)
}
func getEnv(name, defaultValue string) string {
v := os.Getenv(name)
if v == "" {
return defaultValue
}
return v
}