Compare commits

...

3 Commits

Author SHA1 Message Date
420515f5b6 make error message more human readable 2024-07-16 18:19:49 +02:00
5dcd27e8b8 Update traefik router tag 2024-07-15 20:10:06 +02:00
0333862e3c error print fix 2024-05-30 17:19:16 +02:00
2 changed files with 5 additions and 4 deletions

View File

@@ -1,9 +1,9 @@
package config package config
import ( import (
"fmt"
"os" "os"
"github.com/gofiber/fiber/v2/log"
"github.com/joho/godotenv" "github.com/joho/godotenv"
) )
@@ -16,7 +16,7 @@ func init() {
func GetEnv(name string, defVal string) string { func GetEnv(name string, defVal string) string {
env := os.Getenv(name) env := os.Getenv(name)
if env == "" { if env == "" {
fmt.Panicln("Missing " + name + " env variable") log.Panicf("Missing %s env variable", name)
} }
return env return env

View File

@@ -113,7 +113,7 @@ func (s *Service) RegisterHealthChecks() {
ticker := time.NewTicker(interval) ticker := time.NewTicker(interval)
for range ticker.C { for range ticker.C {
if _, err := s.healthCheck(); err != nil { if _, err := s.healthCheck(); err != nil {
fmt.Printf("TTL Error #: %v\n", err) fmt.Printf("HealthCheck endpoint not available #: %v\n", err)
} }
} }
}() }()
@@ -178,7 +178,8 @@ func (s *Service) healthCheck() (bool, error) {
func (s *Service) getTags() []string { func (s *Service) getTags() []string {
tags := []string{ tags := []string{
"traefik.enable=true", "traefik.enable=true",
"traefik.http.routers." + s.Name + ".rule=PathPrefix(`" + s.pathPrefix + "`)", // "traefik.http.routers." + s.Name + ".rule=PathPrefix(`" + s.pathPrefix + "`)",
"traefik.http.routers." + s.Name + ".rule=Host(`" + s.domain + "`)",
"traefik.http.routers." + s.Name + ".entryPoints=https", "traefik.http.routers." + s.Name + ".entryPoints=https",
// "traefik.http.routers." + s.Name + ".tls=true", // "traefik.http.routers." + s.Name + ".tls=true",
"traefik.http.routers." + s.Name + ".service=" + s.Name, "traefik.http.routers." + s.Name + ".service=" + s.Name,