Implemented Rollback Functionality
This commit is contained in:
@@ -14,6 +14,7 @@ function loadEnvironmentConfig() {
|
||||
accessToken: process.env.SHOPIFY_ACCESS_TOKEN,
|
||||
targetTag: process.env.TARGET_TAG,
|
||||
priceAdjustmentPercentage: process.env.PRICE_ADJUSTMENT_PERCENTAGE,
|
||||
operationMode: process.env.OPERATION_MODE || "update", // Default to "update" for backward compatibility
|
||||
};
|
||||
|
||||
// Validate required environment variables
|
||||
@@ -85,12 +86,21 @@ function loadEnvironmentConfig() {
|
||||
);
|
||||
}
|
||||
|
||||
// Validate operation mode
|
||||
const validOperationModes = ["update", "rollback"];
|
||||
if (!validOperationModes.includes(config.operationMode)) {
|
||||
throw new Error(
|
||||
`Invalid OPERATION_MODE: "${config.operationMode}". Must be either "update" or "rollback".`
|
||||
);
|
||||
}
|
||||
|
||||
// Return validated configuration
|
||||
return {
|
||||
shopDomain: config.shopDomain.trim(),
|
||||
accessToken: config.accessToken.trim(),
|
||||
targetTag: trimmedTag,
|
||||
priceAdjustmentPercentage: percentage,
|
||||
operationMode: config.operationMode,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user