consts.ts 690 B

1234567891011121314151617181920212223
  1. import "dotenv/config";
  2. /** API version to use in the base URL */
  3. export const apiVersion = process.env.API_VERSION ?? "v2";
  4. /** Base URL for the locally hosted API */
  5. export const baseUrl = `http://127.0.0.1:${process.env.HTTP_PORT}/${apiVersion}`;
  6. /** Max results that can be returned by geniURL - should be consistent with `maxResultsAmt` in `src/constants.ts` */
  7. export const maxResultsAmt = 10;
  8. /** Auth token for local testing */
  9. const authToken = process.env.AUTH_TOKENS?.split(",")[0];
  10. export const defaultFetchOpts = {
  11. method: "GET",
  12. headers: {
  13. ...(authToken
  14. ? { "Authentication": `Bearer ${authToken}` }
  15. : {}
  16. ),
  17. },
  18. } as const satisfies RequestInit;