About This Article
There are cases where you want different sync behavior between production and test environments, or temporarily stop sync. Therefore, we designed the system to control sync ON/OFF via environment variables.
Why Sync Control is Needed
Scenarios Requiring Control
| Scenario | Required Control | Reason |
|---|---|---|
| Development/testing | Sync OFF | Don't want to send test data to production POS |
| Phased release | Partial ON | First Shopify only, add POS later |
| POS failure | POS sync OFF | Avoid errors, continue registrations |
| Maintenance | All sync OFF | Planned outage |
| Load testing | CRM sync OFF | Avoid impact on non-test systems |
Problems Without Control
- Test data gets registered in production POS
- All registrations fail during POS failure
- Cannot do partial feature releases
Design for Environment Variable Control
Basic Concept
| Environment Variable | true | false |
|---|---|---|
| ENABLE_POS_SYNC | Auto sync to POS on registration | Register to Shopify only (POS manual) |
| ENABLE_CRM_SYNC | Auto sync to HubSpot | No CRM integration |
| ENABLE_UPDATE_SYNC | Sync on customer info update | Sync only on new registration |
Environment-Specific Settings Example
| Environment | POS Sync | CRM Sync | Update Sync | Notes |
|---|---|---|---|---|
| Production | ON | ON | ON | Full functionality |
| Staging | ON | OFF | ON | Test POS integration only |
| Development | OFF | OFF | OFF | For local development |
| E2E Test | OFF | OFF | OFF | For automated tests |
Integration into Processing Flow
Conditional Branching Concept
Receive data submitted from form
Highest priority registration as customer master
ON -> Execute POS sync / OFF -> Skip (log)
ON -> Execute CRM sync / OFF -> Skip (log)
Return result to customer
Log Recording on Skip
Even when sync is skipped, leave logs for later tracking.
| Field | Value | Description |
|---|---|---|
| timestamp | 2024-01-15T10:30:00Z | Processing time |
| event | customer_registration | Event type |
| shopify_customer_id | 12345 | Customer ID |
| sync_status.shopify | success | Shopify registration result |
| sync_status.pos | skipped (disabled) | POS sync result (record skip reason) |
| sync_status.crm | success | CRM sync result |
Can later track "why not synced to POS".
Operational Scenarios
Scenario 1: Phased Release
POS sync OFF, CRM sync OFF for production release. First verify basic functionality
Change POS sync to ON. Batch sync Shopify-registered customers to POS
Change CRM sync to ON. Start marketing integration
Scenario 2: Isolation During Failure
POS sync: ON, CRM sync: ON, All working normally
POS sync: Change to OFF (immediate switch), CRM sync: ON (no impact), Customer registration continues
POS sync: Return to ON, Batch sync registrations during failure, Return to normal operation
Scenario 3: Control in Test Environment
| Environment | POS Sync | POS Connection | Characteristics |
|---|---|---|---|
| Developer local | OFF | - | No impact on production systems |
| Staging | ON | staging-pos.example.com | Can verify with staging POS |
| Production | ON | pos.example.com | Integrated with production POS |
Design Considerations
Timing of Flag Check
Default Value Design
| Flag | Default When Unset | Reason |
|---|---|---|
| ENABLE_POS_SYNC | false | Prevent unintended sync |
| ENABLE_CRM_SYNC | false | Prevent unintended sync |
| ENABLE_UPDATE_SYNC | false | Safely operate new registrations only |
Benefits of This Design
For Development Team
- Don't pollute production systems during testing
- Enables phased releases
- Can minimize failure impact
For Operations Team
- Quick response possible during failures
- Easy control during maintenance
- Settings changeable without deployment
For Business
- Minimized service downtime
- Risk-reduced feature additions
- Flexible operational structure achieved