This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user