Closed as not planned
Description
openedon Jun 17, 2024
I saw a thread somewhere (lost it, sorry) with grumpy tofu maybe mentioning that somehow codegen doesn't ingest env vars for codegen yet. Yearning to hear that i'm wrong, but somehow when i run the
npx @rtk-query/codegen-openapi openapi-config.ts
env var doesn't work.
Thanks in advance
// Or from '@reduxjs/toolkit/query' if not using the auto-generated hooks
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
const { parsed: { DJANGO_URL }, } = require("dotenv").config({ path: "./../../../.env.local" });
// initialize an empty api service that we'll inject endpoints into later as needed
export const empty_api = createApi({
// baseQuery: fetchBaseQuery({ baseUrl: 'http://localhost:8000', } ), // # <-- Works
baseQuery: fetchBaseQuery({ baseUrl: DJANGO_URL } ), // <-- Empty base url after codegen
endpoints: () => ({}),
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels