gluestick/codegen.ts

31 lines
735 B
TypeScript

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;