gluestick/codegen.ts

31 lines
735 B
TypeScript
Raw Permalink Normal View History

2023-04-25 14:33:16 -04:00
import { CodegenConfig } from "@graphql-codegen/cli";
// graphql-codegen doesn't load .env.local, so we have to do it manually
import * as dotenv from "dotenv";
dotenv.config({ path: ".env.local" });
const config: CodegenConfig = {
schema: {
[`http://${process.env.LDAP_HOST}:17170/api/graphql`]: {
headers: {
// can't make the request automatically (await on top level)
Authorization: `Bearer ${process.env.GRAPHQL_CODEGEN_AUTH}`
}
}
},
documents: ["src/**/*.ts", "src/**/*.tsx"],
generates: {
"./src/__generated__/": {
preset: "client",
plugins: [],
presetConfig: {
gqlTagName: "gql"
}
}
},
ignoreNoDocuments: true
};
export default config;