Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wabe): add isProduction to set correctly graphql plugin #150

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/wabe/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type SecurityConfig = {

export interface WabeConfig<T extends WabeTypes> {
port: number
isProduction?: boolean
hostname?: string
security?: SecurityConfig
schema?: SchemaInterface<T>
Expand Down Expand Up @@ -79,6 +80,7 @@ export class Wabe<T extends WabeTypes> {
public controllers: WabeControllers<T>

constructor({
isProduction,
port,
hostname,
security,
Expand All @@ -94,6 +96,7 @@ export class Wabe<T extends WabeTypes> {
routes,
}: WabeConfig<T>) {
this.config = {
isProduction,
port,
hostname,
security,
Expand Down Expand Up @@ -323,9 +326,7 @@ export class Wabe<T extends WabeTypes> {
schema,
maskedErrors: false,
graphqlEndpoint: '/graphql',
plugins: [
process.env.NODE_ENV === 'production' && useDisableIntrospection(),
],
plugins: this.config.isProduction ? [useDisableIntrospection()] : [],
context: async (ctx): Promise<WabeContext<T>> => ctx.wabe,
graphqlMiddleware: async (resolve, res) => {
const response = await resolve()
Expand Down
Loading