Compare commits
4 Commits
sh_24-04-1
...
v0.2.4
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dcd27e8b8 | |||
| 0333862e3c | |||
| 081e1edd24 | |||
| c454307d56 |
@@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
def "git.pbiernat.dev/egommerce/api-entities/http"
|
||||
def "git.pbiernat.io/egommerce/api-entities/http"
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
def "git.pbiernat.dev/egommerce/api-entities/http"
|
||||
def "git.pbiernat.io/egommerce/api-entities/http"
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
@@ -15,7 +16,7 @@ func init() {
|
||||
func GetEnv(name string, defVal string) string {
|
||||
env := os.Getenv(name)
|
||||
if env == "" {
|
||||
return defVal
|
||||
log.Panicf("Missing %s env variable", name)
|
||||
}
|
||||
|
||||
return env
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.pbiernat.dev/egommerce/go-api-pkg/config"
|
||||
"git.pbiernat.io/egommerce/go-api-pkg/config"
|
||||
consul "github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/connect"
|
||||
)
|
||||
@@ -178,9 +178,10 @@ func (s *Service) healthCheck() (bool, error) {
|
||||
func (s *Service) getTags() []string {
|
||||
tags := []string{
|
||||
"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 + ".tls=true",
|
||||
// "traefik.http.routers." + s.Name + ".tls=true",
|
||||
"traefik.http.routers." + s.Name + ".service=" + s.Name,
|
||||
"traefik.http.routers." + s.Name + ".middlewares=auth_" + s.Name + ",requestid_" + s.Name + ",stripprefix_" + s.Name,
|
||||
"traefik.http.services." + s.Name + ".loadbalancer.server.scheme=http",
|
||||
|
||||
4
go.mod
4
go.mod
@@ -1,9 +1,9 @@
|
||||
module git.pbiernat.dev/egommerce/go-api-pkg
|
||||
module git.pbiernat.io/egommerce/go-api-pkg
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
git.pbiernat.dev/egommerce/api-entities v0.0.26
|
||||
git.pbiernat.io/egommerce/api-entities v0.0.26
|
||||
github.com/fluent/fluent-logger-golang v1.9.0
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/hashicorp/consul v1.16.0
|
||||
|
||||
38
redis/cache.go
Normal file
38
redis/cache.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package redis
|
||||
|
||||
// import (
|
||||
// "context"
|
||||
// "strconv"
|
||||
// "time"
|
||||
|
||||
// "github.com/go-redis/redis/v8"
|
||||
// )
|
||||
|
||||
// func NewCache(host string, port int, password string) *redis.Client {
|
||||
// redis := redis.NewClient(&redis.Options{
|
||||
// Addr: host + ":" + strconv.Itoa(port),
|
||||
// Password: password,
|
||||
// DB: 0,
|
||||
// })
|
||||
// defer redis.Close()
|
||||
|
||||
// return redis
|
||||
// }
|
||||
|
||||
// func Get(ctx context.Context, key string) (float64, error) {
|
||||
// // ctx := context.Background() // FIXME
|
||||
// price, err := s.cache.Get(ctx, key).Float64()
|
||||
// if err != nil {
|
||||
// s.log.Log("cache read error(key not exists): %#v", err)
|
||||
// return 0, err
|
||||
// }
|
||||
|
||||
// return price, nil
|
||||
// }
|
||||
|
||||
// func Set(ctx context.Context, key string, value any, exp time.Duration) error {
|
||||
// // ctx := context.Background() // FIXME
|
||||
// s.cache.Set(ctx, key, value, exp)
|
||||
|
||||
// return nil
|
||||
// }
|
||||
Reference in New Issue
Block a user