feat: add configurable VPS provider API URLs for emulator testing
- Add LINODE_API_URL and VULTR_API_URL environment variables - Update LinodeProvider and VultrProvider to accept optional baseUrl - Update ProvisioningService to pass API URLs to providers - Add source_provider and source_region_code to PricingWithProvider type - Use source_provider (linode/vultr) instead of provider_name (Anvil) - Improve error handling for non-JSON responses in LinodeProvider Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,12 +20,14 @@ export class ProvisioningService {
|
||||
db: D1Database, // cloud-instances-db: pricing, providers
|
||||
userDb: D1Database, // telegram-conversations: users, deposits, orders
|
||||
linodeApiKey?: string,
|
||||
vultrApiKey?: string
|
||||
vultrApiKey?: string,
|
||||
linodeApiUrl?: string, // Optional: for testing with emulator
|
||||
vultrApiUrl?: string // Optional: for testing with emulator
|
||||
) {
|
||||
this.env = env;
|
||||
this.repo = new ProvisioningRepository(db, userDb);
|
||||
this.linodeProvider = linodeApiKey ? new LinodeProvider(linodeApiKey) : null;
|
||||
this.vultrProvider = vultrApiKey ? new VultrProvider(vultrApiKey) : null;
|
||||
this.linodeProvider = linodeApiKey ? new LinodeProvider(linodeApiKey, linodeApiUrl) : null;
|
||||
this.vultrProvider = vultrApiKey ? new VultrProvider(vultrApiKey, vultrApiUrl) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user