Files
Dorod-Sky/skyvern-frontend/src/util/env.ts

50 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-04-01 21:34:52 +03:00
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL as string;
if (!apiBaseUrl) {
console.warn("apiBaseUrl environment variable was not set");
2024-04-01 21:34:52 +03:00
}
const environment = import.meta.env.VITE_ENVIRONMENT as string;
if (!environment) {
console.warn("environment environment variable was not set");
2024-04-01 21:34:52 +03:00
}
2024-04-15 11:54:12 -07:00
const envCredential: string | null =
2024-05-09 20:21:13 +03:00
import.meta.env.VITE_SKYVERN_API_KEY ?? null;
2024-04-01 21:34:52 +03:00
2024-04-15 11:54:12 -07:00
const artifactApiBaseUrl = import.meta.env.VITE_ARTIFACT_API_BASE_URL;
2024-04-01 21:34:52 +03:00
if (!artifactApiBaseUrl) {
console.warn("artifactApiBaseUrl environment variable was not set");
2024-04-01 21:34:52 +03:00
}
const apiPathPrefix = import.meta.env.VITE_API_PATH_PREFIX ?? "";
function getGlobalWorkflowIds(): Array<string> {
const globalWorkflowIds = import.meta.env.VITE_GLOBAL_WORKFLOW_IDS;
if (!globalWorkflowIds) {
return [];
}
try {
const globalWorkflowIdsAsAList = JSON.parse(globalWorkflowIds);
if (Array.isArray(globalWorkflowIdsAsAList)) {
return globalWorkflowIdsAsAList;
}
return [];
} catch {
return [];
}
}
const globalWorkflowIds = getGlobalWorkflowIds();
export {
apiBaseUrl,
environment,
envCredential,
artifactApiBaseUrl,
apiPathPrefix,
globalWorkflowIds,
};