hs-ucs-config
v1.0.1
Published
CLI tool to configure UCS rollout settings via API
Downloads
105
Readme
UCS Rollout Config CLI
A command-line tool to configure UCS (Unified Connector Service) rollout settings via API.
Installation
Global Installation
npm install -g ucs-rollout-configUse with npx (No Installation Required)
npx ucs-rollout-config [options]Local Development
# Clone or navigate to the project directory
npm linkUsage
Basic Syntax
ucs-config --port <port> --merchant-id <id> --connector-name <name> [--shadow]Required Parameters
-p, --port <port>- Port number where the config service is running-m, --merchant-id <id>- Merchant ID for configuration-c, --connector-name <name>- Connector name (e.g., stripe, adyen, etc.)
Optional Parameters
-s, --shadow- Enable shadow mode (posts configs with shadow suffix and complex JSON values)--ucs-http-url <url>- UCS HTTP endpoint URL (default:http://localhost:8081)--ucs-https-url <url>- UCS HTTPS endpoint URL (default:https://localhost:8081)--api-key <key>- API key for authentication (default:test_admin)-h, --help- Display help information
Examples
Normal Mode
Posts 6 configurations with value "1.0":
ucs-config -p 8080 -m merchant_123 -c stripeShadow Mode
Posts 6 configurations with _shadow suffix and complex JSON values:
ucs-config -p 8080 -m merchant_123 -c stripe --shadowWith Custom UCS URLs
ucs-config -p 8080 -m merchant_123 -c stripe --shadow \
--ucs-http-url http://ucs-service:9000 \
--ucs-https-url https://ucs-service:9443With Custom API Key
ucs-config -p 8080 -m merchant_123 -c stripe --api-key my_custom_keyWhat It Does
The CLI posts configurations to http://localhost:<port>/configs/ for the following operations:
- Authorize - Authorization operations
- PSync - Payment synchronization
- Void - Void/cancel operations
- Capture - Capture operations
- Execute - Execute operations
- RSync - Refund synchronization
First, it posts ucs_enabled: "true", then posts the rollout configurations.
Normal Mode Configuration
Each config key follows the pattern: ucs_rollout_config_<merchantId>_<connectorName>_<operation>
Value: "1.0"
Shadow Mode Configuration
Each config key follows the pattern: ucs_rollout_config_<merchantId>_<connectorName>_<operation>_shadow
Value: JSON string containing:
{
"rollout_percent": 1.0,
"http_url": "http://localhost:8081",
"https_url": "https://localhost:8081"
}Output
The CLI provides real-time feedback:
Configuring UCS rollout for:
Port: 8080
Merchant ID: merchant_123
Connector: stripe
Mode: Shadow
UCS HTTP URL: http://localhost:8081
UCS HTTPS URL: https://localhost:8081
Posting ucs_enabled config...
✓ ucs_enabled
Posting 6 rollout configurations...
✓ ucs_rollout_config_merchant_123_stripe_card_Authorize_shadow
✓ ucs_rollout_config_merchant_123_stripe_card_PSync_shadow
✓ ucs_rollout_config_merchant_123_stripe_card_Void_shadow
✓ ucs_rollout_config_merchant_123_stripe_card_Capture_shadow
✓ ucs_rollout_config_merchant_123_stripe_Execute_shadow
✓ ucs_rollout_config_merchant_123_stripe_RSync_shadow
Completed: 7 successful, 0 failedError Handling
- Missing required parameters will display validation errors
- Failed HTTP requests will show error details
- Exit code 1 on failures, 0 on success
Requirements
- Node.js >= 14.0.0
- Access to the UCS config service endpoint
Publishing to npm
# Login to npm
npm login
# Publish the package
npm publishLicense
ISC
