fix
Build and Publish / BuildAndDeployAmd64 (push) Failing after 4s
Build and Publish / BuildAndDeployArm64 (push) Failing after 5s

This commit is contained in:
2026-07-05 16:08:57 +02:00
parent eed53c96fb
commit e2f835c01b
2 changed files with 14 additions and 4 deletions
+7 -2
View File
@@ -51,6 +51,8 @@ type Config struct {
CheckoutDataDir string CheckoutDataDir string
// ProfileDataDir holds the profile event logs (optional, default "" — customer endpoints disabled). // ProfileDataDir holds the profile event logs (optional, default "" — customer endpoints disabled).
ProfileDataDir string ProfileDataDir string
// PromotionsFile holds the path to promotions.json (optional).
PromotionsFile string
} }
// App is the commerce admin control plane. Construct with New, register its // App is the commerce admin control plane. Construct with New, register its
@@ -78,7 +80,10 @@ func New(cfg Config) (*App, error) {
_ = os.MkdirAll(cfg.DataDir, 0755) _ = os.MkdirAll(cfg.DataDir, 0755)
reg := cart.NewCartMultationRegistry(cart.NewCartMutationContext(nil)) reg := cart.NewCartMultationRegistry(cart.NewCartMutationContext(nil))
promotionsPath := os.Getenv("PROMOTIONS_FILE") promotionsPath := cfg.PromotionsFile
if promotionsPath == "" {
promotionsPath = os.Getenv("PROMOTIONS_FILE")
}
if promotionsPath == "" { if promotionsPath == "" {
promotionsPath = "data/promotions.json" promotionsPath = "data/promotions.json"
} }
@@ -156,7 +161,7 @@ func New(cfg Config) (*App, error) {
} }
return &App{ return &App{
fs: NewFileServer(cfg.DataDir, cfg.CheckoutDataDir, diskStorage, diskStorageCheckout), fs: NewFileServer(cfg.DataDir, cfg.CheckoutDataDir, promotionsPath, diskStorage, diskStorageCheckout),
hub: NewHub(), hub: NewHub(),
cs: customerSrv, cs: customerSrv,
}, nil }, nil
+7 -2
View File
@@ -26,14 +26,16 @@ type FileServer struct {
// Define fields here // Define fields here
dataDir string dataDir string
checkoutDataDir string checkoutDataDir string
promotionsFile string
storage actor.LogStorage[cart.CartGrain] storage actor.LogStorage[cart.CartGrain]
checkoutStorage actor.LogStorage[checkout.CheckoutGrain] checkoutStorage actor.LogStorage[checkout.CheckoutGrain]
} }
func NewFileServer(dataDir string, checkoutDataDir string, storage actor.LogStorage[cart.CartGrain], checkoutStorage actor.LogStorage[checkout.CheckoutGrain]) *FileServer { func NewFileServer(dataDir string, checkoutDataDir string, promotionsFile string, storage actor.LogStorage[cart.CartGrain], checkoutStorage actor.LogStorage[checkout.CheckoutGrain]) *FileServer {
return &FileServer{ return &FileServer{
dataDir: dataDir, dataDir: dataDir,
checkoutDataDir: checkoutDataDir, checkoutDataDir: checkoutDataDir,
promotionsFile: promotionsFile,
storage: storage, storage: storage,
checkoutStorage: checkoutStorage, checkoutStorage: checkoutStorage,
} }
@@ -215,7 +217,10 @@ func (fs *FileServer) CheckoutsHandler(w http.ResponseWriter, r *http.Request) {
} }
func (fs *FileServer) PromotionsHandler(w http.ResponseWriter, r *http.Request) { func (fs *FileServer) PromotionsHandler(w http.ResponseWriter, r *http.Request) {
fileName := filepath.Join(fs.dataDir, "promotions.json") fileName := fs.promotionsFile
if fileName == "" {
fileName = filepath.Join(fs.dataDir, "promotions.json")
}
if r.Method == http.MethodGet { if r.Method == http.MethodGet {
file, err := os.Open(fileName) file, err := os.Open(fileName)
if err != nil { if err != nil {