mirror of
https://github.com/cubixle/tuukoti-cli.git
synced 2026-04-24 22:34:45 +01:00
44 lines
614 B
Cheetah
44 lines
614 B
Cheetah
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/cubixle/testing/internal/http"
|
|
"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
|
|
}
|