signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
30 lines • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveCustomS3Endpoint = resolveCustomS3Endpoint;
function resolveCustomS3Endpoint(endpoint, forcePathStyleConfig) {
let parsed;
try {
parsed = new URL(endpoint);
}
catch {
throw new Error(`cloudUpload.endpoint must be a full URL including scheme (e.g. "https://${endpoint}"), got: "${endpoint}"`);
}
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
throw new Error(`cloudUpload.endpoint must use http:// or https://, got: "${endpoint}"`);
}
if (!parsed.host) {
throw new Error(`cloudUpload.endpoint is missing a host: "${endpoint}"`);
}
if ((parsed.pathname && parsed.pathname !== '/') ||
parsed.search ||
parsed.hash) {
throw new Error(`cloudUpload.endpoint must be an origin only (scheme + host[:port]), with no path, query, or fragment: "${endpoint}"`);
}
return {
url: endpoint,
host: parsed.host,
useSSL: parsed.protocol === 'https:',
forcePathStyle: forcePathStyleConfig !== undefined ? forcePathStyleConfig : true,
};
}
//# sourceMappingURL=cloud-endpoint.js.map