INNER CODE UNIT · TypeScript
readTransitFileOptions
oomol-lab/open-connector · src/server/index.ts:222
function readTransitFileOptions(): ConnectorTransitFileOptions {
const backend = process.env.OOMOL_CONNECT_TRANSIT_FILE_BACKEND ?? "local";
const options: ConnectorTransitFileOptions = { ttlSeconds: transitFileTtlSeconds, maxBytes: transitFileMaxBytes };
if (backend === "local") return options;
if (backend !== "s3") throw new Error(`Unsupported OOMOL_CONNECT_TRANSIT_FILE_BACKEND: ${backend}`);
const accessKeyId = optionalEnv("OOMOL_CONNECT_S3_ACCESS_KEY_ID");
const secretAccessKey = optionalEnv("OOMOL_CONNECT_S3_SECRET_ACCESS_KEY");
if (Boolean(accessKeyId) !== Boolean(secretAccessKey)) {
throw new Error(
"OOMOL_CONNECT_S3_ACCESS_KEY_ID and OOMOL_CONNECT_S3_SECRET_ACCESS_KEY must be configured together.",
);
}
options.s3 = {
region: optionalEnv("OOMOL_CONNECT_S3_REGION") ?? "us-east-1",
endpoint: optionalEnv("OOMOL_CONNECT_S3_ENDPOINT"),
forcePathStyle: parseBooleanEnv("OOMOL_CONNECT_S3_FORCE_PATH_STYLE"),
credentials:
accessKeyId && secretAccessKey