fix
This commit is contained in:
@@ -51,6 +51,8 @@ type Config struct {
|
||||
CheckoutDataDir string
|
||||
// ProfileDataDir holds the profile event logs (optional, default "" — customer endpoints disabled).
|
||||
ProfileDataDir string
|
||||
// PromotionsFile holds the path to promotions.json (optional).
|
||||
PromotionsFile string
|
||||
}
|
||||
|
||||
// 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)
|
||||
reg := cart.NewCartMultationRegistry(cart.NewCartMutationContext(nil))
|
||||
|
||||
promotionsPath := os.Getenv("PROMOTIONS_FILE")
|
||||
promotionsPath := cfg.PromotionsFile
|
||||
if promotionsPath == "" {
|
||||
promotionsPath = os.Getenv("PROMOTIONS_FILE")
|
||||
}
|
||||
if promotionsPath == "" {
|
||||
promotionsPath = "data/promotions.json"
|
||||
}
|
||||
@@ -156,7 +161,7 @@ func New(cfg Config) (*App, error) {
|
||||
}
|
||||
|
||||
return &App{
|
||||
fs: NewFileServer(cfg.DataDir, cfg.CheckoutDataDir, diskStorage, diskStorageCheckout),
|
||||
fs: NewFileServer(cfg.DataDir, cfg.CheckoutDataDir, promotionsPath, diskStorage, diskStorageCheckout),
|
||||
hub: NewHub(),
|
||||
cs: customerSrv,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user