feat: enforce production pricing provider config
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-10 01:46:58 -04:00
parent f837324cf5
commit 4f0e3d89f6
6 changed files with 66 additions and 4 deletions
@@ -1,5 +1,23 @@
import { createPricingProvider } from './pricing-provider.js';
export function assertProductionPricingProviderConfig({ fixtureEnabled, endpoint }) {
if (fixtureEnabled) {
throw new Error('The fixture pricing provider must be disabled in production.');
}
if (typeof endpoint !== 'string' || endpoint.trim().length === 0) {
throw new Error('A production pricing provider endpoint is required.');
}
let parsedUrl;
try {
parsedUrl = new URL(endpoint);
} catch {
throw new Error('The production pricing provider endpoint must be a valid HTTPS URL.');
}
if (parsedUrl.protocol !== 'https:') {
throw new Error('The production pricing provider endpoint must use HTTPS.');
}
}
export function createHttpPricingProvider({
id,
endpoint,