Compare commits

..

2 Commits

Author SHA1 Message Date
11900eeecd Fixed req with insecured tls 2025-11-15 21:16:34 +01:00
4f9ef33ab1 Added baseURL for rest api clients 2025-11-15 20:57:30 +01:00
3 changed files with 12 additions and 3 deletions

View File

@@ -4,10 +4,11 @@ import (
"fmt" "fmt"
basket "git.ego.freeddns.org/egommerce/api-entities/basket/dto" basket "git.ego.freeddns.org/egommerce/api-entities/basket/dto"
cnf "git.ego.freeddns.org/egommerce/go-api-pkg/config"
) )
func NewBasketAPI() *BasketAPI { func NewBasketAPI() *BasketAPI {
return &BasketAPI{NewHttpClient()} return &BasketAPI{NewHttpClient(cnf.GetEnv("API_REST_BASKET", "basket-svc"))}
} }
type BasketAPI struct { type BasketAPI struct {

View File

@@ -2,6 +2,7 @@ package api
import ( import (
"bytes" "bytes"
"crypto/tls"
"encoding/json" "encoding/json"
"net/http" "net/http"
) )
@@ -47,7 +48,13 @@ func (c *HttpClient) SendPost(api, url string, data, out any) (any, error) {
func (c *HttpClient) sendRequest(api, url, method string, data any) (*http.Response, error) { func (c *HttpClient) sendRequest(api, url, method string, data any) (*http.Response, error) {
apiUrl := api + url // FIXME apiUrl := api + url // FIXME
client := &http.Client{}
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // FIXME
}
// Create an HTTP client with the custom transport
client := &http.Client{Transport: tr} // FIXME
json, err := json.Marshal(&data) json, err := json.Marshal(&data)
if err != nil { if err != nil {

View File

@@ -4,10 +4,11 @@ import (
"fmt" "fmt"
pricing "git.ego.freeddns.org/egommerce/api-entities/pricing/dto" pricing "git.ego.freeddns.org/egommerce/api-entities/pricing/dto"
cnf "git.ego.freeddns.org/egommerce/go-api-pkg/config"
) )
func NewPricingAPI() *PricingAPI { func NewPricingAPI() *PricingAPI {
return &PricingAPI{NewHttpClient()} return &PricingAPI{NewHttpClient(cnf.GetEnv("API_REST_PRICING", "pricing-svc"))}
} }
type PricingAPI struct { type PricingAPI struct {