Merge branch 'develop' of Software_Engineering_I/greenvironment-server into master

pull/5/head
Trivernis 5 years ago committed by Gitea
commit 196a1ac043

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- joined field to Group gql type - joined field to Group gql type
- rate limits with defaults of 10/min for `/upload` and 30/min for `/graphql` - rate limits with defaults of 10/min for `/upload` and 30/min for `/graphql`
- complexity limits for graphql queries that can be configured with the `api.maxQueryComplexity` option - complexity limits for graphql queries that can be configured with the `api.maxQueryComplexity` option
- complexity headers `X-Query-Complexity` and `X-Max-Query-Complexity`
### Removed ### Removed

@ -20,7 +20,6 @@ import * as redis from "redis";
import {Sequelize} from "sequelize-typescript"; import {Sequelize} from "sequelize-typescript";
import * as socketIo from "socket.io"; import * as socketIo from "socket.io";
import * as socketIoRedis from "socket.io-redis"; import * as socketIoRedis from "socket.io-redis";
import {query} from "winston";
import {resolver} from "./graphql/resolvers"; import {resolver} from "./graphql/resolvers";
import dataaccess from "./lib/dataAccess"; import dataaccess from "./lib/dataAccess";
import globals from "./lib/globals"; import globals from "./lib/globals";
@ -194,6 +193,7 @@ class App {
// @ts-ignore // @ts-ignore
this.app.use("/graphql", graphqlHTTP(async (request, response, {variables}) => { this.app.use("/graphql", graphqlHTTP(async (request, response, {variables}) => {
response.setHeader("X-Max-Query-Complexity", config.get("api.maxQueryComplexity"));
return { return {
// @ts-ignore all // @ts-ignore all
context: {session: request.session}, context: {session: request.session},
@ -209,6 +209,7 @@ class App {
maximumComplexity: config.get("api.maxQueryComplexity"), maximumComplexity: config.get("api.maxQueryComplexity"),
onComplete: (complexity: number) => { onComplete: (complexity: number) => {
logger.debug(`QueryComplexity: ${complexity}`); logger.debug(`QueryComplexity: ${complexity}`);
response.setHeader("X-Query-Complexity", complexity);
}, },
variables, variables,
}), }),

Loading…
Cancel
Save