update cart deployment
This commit is contained in:
31
main.go
31
main.go
@@ -3,12 +3,6 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
messages "git.tornberg.me/go-cart-actor/proto"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
@@ -16,6 +10,13 @@ import (
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
messages "git.tornberg.me/go-cart-actor/proto"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -127,6 +128,14 @@ var tpl = `<!DOCTYPE html>
|
||||
`
|
||||
|
||||
func main() {
|
||||
baseUrl := os.Getenv("BASE_URL")
|
||||
cartBaseUrl := os.Getenv("CART_BASE_URL")
|
||||
if cartBaseUrl == "" {
|
||||
cartBaseUrl = "https://cart.tornberg.me"
|
||||
}
|
||||
if baseUrl == "" {
|
||||
baseUrl = "https://slask-finder.tornberg.me"
|
||||
}
|
||||
// Create a new instance of the server
|
||||
storage, err := NewDiskStorage(fmt.Sprintf("data/%s_state.gob", name))
|
||||
if err != nil {
|
||||
@@ -216,11 +225,11 @@ func main() {
|
||||
reply, err := syncedServer.pool.Process(cartId, Message{
|
||||
Type: CreateCheckoutOrderType,
|
||||
Content: &messages.CreateCheckoutOrder{
|
||||
Terms: "https://slask-finder.tornberg.me/terms",
|
||||
Checkout: "https://slask-finder.tornberg.me/checkout?order_id={checkout.order.id}",
|
||||
Confirmation: "https://slask-finder.tornberg.me/confirmation/{checkout.order.id}",
|
||||
Validation: "https://cart.tornberg.me/validation",
|
||||
Push: "https://cart.tornberg.me/push?order_id={checkout.order.id}",
|
||||
Terms: fmt.Sprintf("%s/terms", baseUrl),
|
||||
Checkout: fmt.Sprintf("%s/checkout?order_id={checkout.order.id}", baseUrl),
|
||||
Confirmation: fmt.Sprintf("%s/confirmation/{checkout.order.id}", baseUrl),
|
||||
Validation: fmt.Sprintf("%s/validation", cartBaseUrl),
|
||||
Push: fmt.Sprintf("%s/push?order_id={checkout.order.id}", cartBaseUrl),
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -2,15 +2,26 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/matst80/slask-finder/pkg/index"
|
||||
)
|
||||
|
||||
/** end */
|
||||
var baseUrl string
|
||||
|
||||
func init() {
|
||||
baseUrl = "https://slask-finder.tornberg.me"
|
||||
envUrl := os.Getenv("BASE_URL")
|
||||
if envUrl != "" {
|
||||
baseUrl = envUrl
|
||||
}
|
||||
}
|
||||
|
||||
func FetchItem(sku string) (*index.DataItem, error) {
|
||||
res, err := http.Get("https://slask-finder.tornberg.me/api/by-sku/" + sku)
|
||||
res, err := http.Get(fmt.Sprintf("%s/api/by-sku/%s", baseUrl, sku))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user