prod deploy next try

This commit is contained in:
Samuel Andert 2023-08-23 16:49:09 +02:00
parent 510f7fc4d7
commit 25d9ba4469
7 changed files with 10 additions and 6 deletions

View File

@ -6,7 +6,7 @@ sources:
handler: handler:
graphql: graphql:
endpoint: https://directus.andert.me/graphql endpoint: https://directus.andert.me/graphql
source: ./src/schemas/directus.graphql source: ./public/schemas/directus.graphql
operationHeaders: operationHeaders:
Authorization: Bearer {env.DIRECTUS_API} Authorization: Bearer {env.DIRECTUS_API}
additionalResolvers: additionalResolvers:
@ -16,13 +16,13 @@ additionalResolvers:
# handler: # handler:
# openapi: # openapi:
# endpoint: https://my.andert.me/api/v1 # endpoint: https://my.andert.me/api/v1
# source: ./src/schemas/cloudron.json # source: ./public/schemas/cloudron.json
# operationHeaders: # operationHeaders:
# Authorization: Bearer {env.CLOUDRON_API} # Authorization: Bearer {env.CLOUDRON_API}
# - name: Gitea # - name: Gitea
# handler: # handler:
# openapi: # openapi:
# endpoint: https://git.andert.me/api/v1 # endpoint: https://git.andert.me/api/v1
# source: ./src/schemas/gitea.yml # source: ./public/schemas/gitea.yml
# operationHeaders: # operationHeaders:
# Authorization: Bearer {env.GITEA_API} # Authorization: Bearer {env.GITEA_API}

View File

@ -24,7 +24,7 @@ async function fetchSchema() {
}); });
// Save the schema to a file // Save the schema to a file
fs.writeFileSync('./src/schemas/directus.graphql', schema); fs.writeFileSync('./public/schemas/directus.graphql', schema);
} }
fetchSchema().catch(console.error); fetchSchema().catch(console.error);

View File

@ -7,8 +7,12 @@ const path = require('path')
const pubsub = new PubSub(); const pubsub = new PubSub();
// Generate an absolute path to the schema file let schemaFilePath;
const schemaFilePath = path.resolve(process.cwd(), 'src/schemas/directus.graphql'); if (process.env.NODE_ENV === 'production') {
schemaFilePath = path.resolve(process.cwd(), 'schemas/directus.graphql');
} else {
schemaFilePath = path.resolve(process.cwd(), 'public/schemas/directus.graphql');
}
// Read the schema file // Read the schema file
const schema = fs.readFileSync(schemaFilePath, 'utf8'); const schema = fs.readFileSync(schemaFilePath, 'utf8');