mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
feat(graphql): migrate to lighthousephp (#1183)
This commit is contained in:
@@ -216,6 +216,9 @@ return [
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
Nuwave\Lighthouse\Pennant\PennantServiceProvider::class,
|
||||
Nuwave\Lighthouse\Scout\ScoutServiceProvider::class,
|
||||
Nuwave\Lighthouse\WhereConditions\WhereConditionsServiceProvider::class,
|
||||
OwenIt\Auditing\AuditingServiceProvider::class,
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\GraphQL\Schema\Schemas\V1Schema;
|
||||
use App\GraphQL\Schema\Types\Base\PaginationInfoType;
|
||||
|
||||
return [
|
||||
'domain' => env('GRAPHQL_URL', env('APP_URL')),
|
||||
|
||||
'route' => [
|
||||
// The prefix for routes; do NOT use a leading slash!
|
||||
'prefix' => env('GRAPHQL_PATH', '/'),
|
||||
|
||||
// Also supported array syntax: `[\Rebing\GraphQL\GraphQLController::class, 'query']`
|
||||
'controller' => Rebing\GraphQL\GraphQLController::class.'@query',
|
||||
|
||||
// This middleware will apply to all schemas
|
||||
'middleware' => [
|
||||
'graphql',
|
||||
],
|
||||
|
||||
// Additional route group attributes
|
||||
// 'group_attributes' => ['guard' => 'api']
|
||||
//
|
||||
'group_attributes' => [
|
||||
'guard' => 'web',
|
||||
],
|
||||
],
|
||||
|
||||
// The name of the default schema
|
||||
// Used when the route group is directly accessed
|
||||
'default_schema' => 'v1',
|
||||
|
||||
'batching' => [
|
||||
// Whether to support GraphQL batching or not.
|
||||
// See e.g. https://www.apollographql.com/blog/batching-client-graphql-queries-a685f5bcd41b/
|
||||
// for pro and con
|
||||
'enable' => true,
|
||||
],
|
||||
|
||||
// The schemas for query and/or mutation. It expects an array of schemas to provide
|
||||
// both the 'query' fields and the 'mutation' fields.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// 'schemas' => [
|
||||
// 'default' => [
|
||||
// 'controller' => MyController::class . '@method',
|
||||
// 'query' => [
|
||||
// App\GraphQL\Queries\UsersQuery::class,
|
||||
// ],
|
||||
// 'mutation' => [
|
||||
//
|
||||
// ]
|
||||
// ],
|
||||
// 'user/me' => [
|
||||
// 'query' => [
|
||||
// App\GraphQL\Queries\MyProfileQuery::class,
|
||||
// ],
|
||||
// 'mutation' => [
|
||||
//
|
||||
// ],
|
||||
// 'middleware' => ['auth'],
|
||||
// ],
|
||||
// ]
|
||||
//
|
||||
'schemas' => [
|
||||
'v1' => V1Schema::class,
|
||||
],
|
||||
|
||||
// The global types available to all schemas.
|
||||
'types' => [
|
||||
// Pagination
|
||||
PaginationInfoType::class,
|
||||
],
|
||||
|
||||
// This callable will be passed the Error object for each errors GraphQL catch.
|
||||
// The method should return an array representing the error.
|
||||
// Typically:
|
||||
// [
|
||||
// 'message' => '',
|
||||
// 'locations' => []
|
||||
// ]
|
||||
'error_formatter' => [App\GraphQL\Handler\ErrorHandler::class, 'formatError'],
|
||||
|
||||
/*
|
||||
* Custom Error Handling
|
||||
*
|
||||
* Expected handler signature is: function (array $errors, callable $formatter): array
|
||||
*
|
||||
* The default handler will pass exceptions to laravel Error Handling mechanism
|
||||
*/
|
||||
'errors_handler' => [App\GraphQL\Handler\ErrorHandler::class, 'handleErrors'],
|
||||
|
||||
/*
|
||||
* Options to limit the query complexity and depth. See the doc
|
||||
* @ https://webonyx.github.io/graphql-php/security
|
||||
* for details. Disabled by default.
|
||||
*/
|
||||
'security' => [
|
||||
'query_max_complexity' => 0, // 250 in GraphQLServiceProvider
|
||||
'query_max_depth' => 13,
|
||||
'disable_introspection' => false,
|
||||
],
|
||||
|
||||
// Custom array
|
||||
'pagination_values' => [
|
||||
'default_count' => 15,
|
||||
'max_count' => 100,
|
||||
'relation' => [
|
||||
'default_count' => 1000000,
|
||||
'max_count' => null,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Reference \Rebing\GraphQL\Support\PaginationType::class
|
||||
*/
|
||||
'pagination_type' => App\GraphQL\Schema\Types\Base\PaginationType::class,
|
||||
|
||||
/*
|
||||
* Reference \Rebing\GraphQL\Support\SimplePaginationType::class
|
||||
*/
|
||||
'simple_pagination_type' => Rebing\GraphQL\Support\SimplePaginationType::class,
|
||||
|
||||
/*
|
||||
* Reference Rebing\GraphQL\Support\CursorPaginationType::class
|
||||
*/
|
||||
'cursor_pagination_type' => Rebing\GraphQL\Support\CursorPaginationType::class,
|
||||
|
||||
/*
|
||||
* Overrides the default field resolver
|
||||
* See http://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```php
|
||||
* 'defaultFieldResolver' => function ($root, $args, $context, $info) {
|
||||
* },
|
||||
* ```
|
||||
* or
|
||||
* ```php
|
||||
* 'defaultFieldResolver' => [SomeKlass::class, 'someMethod'],
|
||||
* ```
|
||||
*/
|
||||
'defaultFieldResolver' => null,
|
||||
|
||||
/*
|
||||
* Any headers that will be added to the response returned by the default controller
|
||||
*/
|
||||
'headers' => [],
|
||||
|
||||
/*
|
||||
* Any JSON encoding options when returning a response from the default controller
|
||||
* See http://php.net/manual/function.json-encode.php for the full list of options
|
||||
*/
|
||||
'json_encoding_options' => 0,
|
||||
|
||||
/*
|
||||
* Automatic Persisted Queries (APQ)
|
||||
* See https://www.apollographql.com/docs/apollo-server/performance/apq/
|
||||
*
|
||||
* Note 1: this requires the `AutomaticPersistedQueriesMiddleware` being enabled
|
||||
*
|
||||
* Note 2: even if APQ is disabled per configuration and, according to the "APQ specs" (see above),
|
||||
* to return a correct response in case it's not enabled, the middleware needs to be active.
|
||||
* Of course if you know you do not have a need for APQ, feel free to remove the middleware completely.
|
||||
*/
|
||||
'apq' => [
|
||||
// Enable/Disable APQ - See https://www.apollographql.com/docs/apollo-server/performance/apq/#disabling-apq
|
||||
'enable' => env('GRAPHQL_APQ_ENABLE', false),
|
||||
|
||||
// The cache driver used for APQ
|
||||
'cache_driver' => env('GRAPHQL_APQ_CACHE_DRIVER', config('cache.default')),
|
||||
|
||||
// The cache prefix
|
||||
'cache_prefix' => config('cache.prefix').':graphql.apq',
|
||||
|
||||
// The cache ttl in seconds - See https://www.apollographql.com/docs/apollo-server/performance/apq/#adjusting-cache-time-to-live-ttl
|
||||
'cache_ttl' => 300,
|
||||
],
|
||||
|
||||
'execution_middleware' => [
|
||||
Rebing\GraphQL\Support\ExecutionMiddleware\ValidateOperationParamsMiddleware::class,
|
||||
// AutomaticPersistedQueriesMiddleware listed even if APQ is disabled, see the docs for the `'apq'` configuration
|
||||
Rebing\GraphQL\Support\ExecutionMiddleware\AutomaticPersistedQueriesMiddleware::class,
|
||||
Rebing\GraphQL\Support\ExecutionMiddleware\AddAuthUserContextValueMiddleware::class,
|
||||
// \Rebing\GraphQL\Support\ExecutionMiddleware\UnusedVariablesMiddleware::class,
|
||||
],
|
||||
|
||||
'resolver_middleware_append' => null,
|
||||
];
|
||||
@@ -0,0 +1,576 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Http\Middleware\GraphQL\LogGraphQLRequest;
|
||||
use App\Http\Middleware\GraphQL\MaxCount;
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Route Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Controls the HTTP route that your GraphQL server responds to.
|
||||
| You may set `route` => false, to disable the default route
|
||||
| registration and take full control.
|
||||
|
|
||||
*/
|
||||
|
||||
'route' => [
|
||||
/*
|
||||
* The URI the endpoint responds to, e.g. mydomain.com/graphql.
|
||||
*/
|
||||
'uri' => env('GRAPHQL_PATH', '/'),
|
||||
|
||||
/*
|
||||
* Lighthouse creates a named route for convenient URL generation and redirects.
|
||||
*/
|
||||
'name' => 'graphql',
|
||||
|
||||
/*
|
||||
* Beware that middleware defined here runs before the GraphQL execution phase.
|
||||
* Make sure to return spec-compliant responses in case an error is thrown.
|
||||
*/
|
||||
'middleware' => [
|
||||
'graphql',
|
||||
|
||||
// Allow client to get full database.
|
||||
MaxCount::class,
|
||||
|
||||
// Logs GraphQL Requests.
|
||||
LogGraphQLRequest::class,
|
||||
|
||||
// Ensures the request is not vulnerable to cross-site request forgery.
|
||||
Nuwave\Lighthouse\Http\Middleware\EnsureXHR::class,
|
||||
|
||||
// Always set the `Accept: application/json` header.
|
||||
Nuwave\Lighthouse\Http\Middleware\AcceptJson::class,
|
||||
|
||||
// Logs in a user if they are authenticated. In contrast to Laravel's 'auth'
|
||||
// middleware, this delegates auth and permission checks to the field level.
|
||||
Nuwave\Lighthouse\Http\Middleware\AttemptAuthentication::class,
|
||||
|
||||
// Logs every incoming GraphQL query.
|
||||
// Nuwave\Lighthouse\Http\Middleware\LogGraphQLQueries::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* The `prefix`, `domain` and `where` configuration options are optional.
|
||||
*/
|
||||
// 'prefix' => '',
|
||||
'domain' => env('GRAPHQL_URL'),
|
||||
// 'where' => [],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The guards to use for authenticating GraphQL requests, if needed.
|
||||
| Used in directives such as `@guard` or the `AttemptAuthentication` middleware.
|
||||
| Falls back to the Laravel default if `null`.
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Schema Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Path to your .graphql schema file.
|
||||
| Additional schema files may be imported from within that file.
|
||||
|
|
||||
*/
|
||||
|
||||
'schema_path' => base_path('graphql/schema.graphql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Schema Cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A large part of schema generation consists of parsing and AST manipulation.
|
||||
| This operation is very expensive, so it is highly recommended enabling
|
||||
| caching of the final schema to optimize performance of large schemas.
|
||||
|
|
||||
*/
|
||||
|
||||
'schema_cache' => [
|
||||
/*
|
||||
* Setting to true enables schema caching.
|
||||
*/
|
||||
'enable' => env('LIGHTHOUSE_SCHEMA_CACHE_ENABLE', env('APP_ENV') !== 'local'),
|
||||
|
||||
/*
|
||||
* File path to store the lighthouse schema.
|
||||
*/
|
||||
'path' => env('LIGHTHOUSE_SCHEMA_CACHE_PATH', base_path('bootstrap/cache/lighthouse-schema.php')),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directive Tags
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Should the `@cache` directive use a tagged cache?
|
||||
|
|
||||
*/
|
||||
'cache_directive_tags' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Query Cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Caches the result of parsing incoming query strings to boost performance on subsequent requests.
|
||||
|
|
||||
*/
|
||||
|
||||
'query_cache' => [
|
||||
/*
|
||||
* Setting to true enables query caching.
|
||||
*/
|
||||
'enable' => env('LIGHTHOUSE_QUERY_CACHE_ENABLE', true),
|
||||
|
||||
/*
|
||||
* Configures which mechanism to use for the query cache.
|
||||
* - store: use an external shared cache through a Laravel cache store like Redis or Memcached
|
||||
* - opcache: store parsed queries in PHP files on the local filesystem to leverage OPcache
|
||||
* - hybrid: leverage OPcache, but use a shared cache store when local files are not found
|
||||
*/
|
||||
'mode' => env('LIGHTHOUSE_QUERY_CACHE_MODE', 'store'),
|
||||
|
||||
/*
|
||||
* Specifies the path where the PHP files are stored when using opcache or hybrid mode.
|
||||
* The given path must be a folder, as every query will produce its own file.
|
||||
*/
|
||||
'opcache_path' => env('LIGHTHOUSE_QUERY_CACHE_OPCACHE_PATH', base_path('bootstrap/cache')),
|
||||
|
||||
/*
|
||||
* Allows using a specific cache store, uses the app's default if set to null.
|
||||
* Not relevant when using opcache mode.
|
||||
*/
|
||||
'store' => env('LIGHTHOUSE_QUERY_CACHE_STORE', null),
|
||||
|
||||
/*
|
||||
* Duration in seconds the query should remain cached, null means forever.
|
||||
* Not relevant when using opcache mode.
|
||||
*/
|
||||
'ttl' => env('LIGHTHOUSE_QUERY_CACHE_TTL', 24 * 60 * 60),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Caches the result of validating queries to boost performance on subsequent requests.
|
||||
|
|
||||
*/
|
||||
|
||||
'validation_cache' => [
|
||||
/*
|
||||
* Setting to true enables validation caching.
|
||||
*/
|
||||
'enable' => env('LIGHTHOUSE_VALIDATION_CACHE_ENABLE', false),
|
||||
|
||||
/*
|
||||
* Allows using a specific cache store, uses the app's default if set to null.
|
||||
*/
|
||||
'store' => env('LIGHTHOUSE_VALIDATION_CACHE_STORE', null),
|
||||
|
||||
/*
|
||||
* Duration in seconds the validation result should remain cached, null means forever.
|
||||
*/
|
||||
'ttl' => env('LIGHTHOUSE_VALIDATION_CACHE_TTL', 24 * 60 * 60),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Parse source location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Should the source location be included in the AST nodes resulting from query parsing?
|
||||
| Setting this to `false` improves performance, but omits the key `locations` from errors,
|
||||
| see https://spec.graphql.org/October2021/#sec-Errors.Error-result-format.
|
||||
|
|
||||
*/
|
||||
|
||||
'parse_source_location' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Namespaces
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the default namespaces where Lighthouse looks for classes to
|
||||
| extend functionality of the schema. You may pass in either a string
|
||||
| or an array, they are tried in order and the first match is used.
|
||||
|
|
||||
*/
|
||||
|
||||
'namespaces' => [
|
||||
'models' => ['App', 'App\\Models', 'App\\Pivots'],
|
||||
'queries' => 'App\\GraphQL\\Queries',
|
||||
'mutations' => 'App\\GraphQL\\Mutations',
|
||||
'subscriptions' => 'App\\GraphQL\\Subscriptions',
|
||||
'types' => 'App\\GraphQL\\Types',
|
||||
'interfaces' => 'App\\GraphQL\\Interfaces',
|
||||
'unions' => 'App\\GraphQL\\Unions',
|
||||
'scalars' => 'App\\GraphQL\\Scalars',
|
||||
'directives' => 'App\\GraphQL\\Directives',
|
||||
'validators' => 'App\\GraphQL\\Validators',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Security
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Control how Lighthouse handles security related query validation.
|
||||
| Read more at https://webonyx.github.io/graphql-php/security/
|
||||
|
|
||||
*/
|
||||
|
||||
'security' => [
|
||||
// Handled dynamically
|
||||
'max_query_complexity' => GraphQL\Validator\Rules\QueryComplexity::DISABLED,
|
||||
'max_query_depth' => 13,
|
||||
'disable_introspection' => (bool) env('LIGHTHOUSE_SECURITY_DISABLE_INTROSPECTION', false)
|
||||
? GraphQL\Validator\Rules\DisableIntrospection::ENABLED
|
||||
: GraphQL\Validator\Rules\DisableIntrospection::DISABLED,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pagination
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set defaults for the pagination features within Lighthouse, such as
|
||||
| the @paginate directive, or paginated relation directives.
|
||||
|
|
||||
*/
|
||||
|
||||
'pagination' => [
|
||||
/*
|
||||
* Allow clients to query paginated lists without specifying the amount of items.
|
||||
* Setting this to `null` means clients have to explicitly ask for the count.
|
||||
*/
|
||||
'default_count' => 15,
|
||||
|
||||
/*
|
||||
* Limit the maximum amount of items that clients can request from paginated lists.
|
||||
* Setting this to `null` means the count is unrestricted.
|
||||
*/
|
||||
'max_count' => 100,
|
||||
|
||||
// Custom keys
|
||||
'relation' => [
|
||||
/*
|
||||
* Allow clients to query paginated lists without specifying the amount of items.
|
||||
* Setting this to `null` means clients have to explicitly ask for the count.
|
||||
*/
|
||||
'default_count' => 1000,
|
||||
|
||||
/*
|
||||
* Limit the maximum amount of items that clients can request from paginated lists.
|
||||
* Setting this to `null` means the count is unrestricted.
|
||||
*/
|
||||
'max_count' => null,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Control the debug level as described in https://webonyx.github.io/graphql-php/error-handling/
|
||||
| Debugging is only applied if the global Laravel debug config is set to true.
|
||||
|
|
||||
| When you set this value through an environment variable, use the following reference table:
|
||||
| 0 => INCLUDE_NONE
|
||||
| 1 => INCLUDE_DEBUG_MESSAGE
|
||||
| 2 => INCLUDE_TRACE
|
||||
| 3 => INCLUDE_TRACE | INCLUDE_DEBUG_MESSAGE
|
||||
| 4 => RETHROW_INTERNAL_EXCEPTIONS
|
||||
| 5 => RETHROW_INTERNAL_EXCEPTIONS | INCLUDE_DEBUG_MESSAGE
|
||||
| 6 => RETHROW_INTERNAL_EXCEPTIONS | INCLUDE_TRACE
|
||||
| 7 => RETHROW_INTERNAL_EXCEPTIONS | INCLUDE_TRACE | INCLUDE_DEBUG_MESSAGE
|
||||
| 8 => RETHROW_UNSAFE_EXCEPTIONS
|
||||
| 9 => RETHROW_UNSAFE_EXCEPTIONS | INCLUDE_DEBUG_MESSAGE
|
||||
| 10 => RETHROW_UNSAFE_EXCEPTIONS | INCLUDE_TRACE
|
||||
| 11 => RETHROW_UNSAFE_EXCEPTIONS | INCLUDE_TRACE | INCLUDE_DEBUG_MESSAGE
|
||||
| 12 => RETHROW_UNSAFE_EXCEPTIONS | RETHROW_INTERNAL_EXCEPTIONS
|
||||
| 13 => RETHROW_UNSAFE_EXCEPTIONS | RETHROW_INTERNAL_EXCEPTIONS | INCLUDE_DEBUG_MESSAGE
|
||||
| 14 => RETHROW_UNSAFE_EXCEPTIONS | RETHROW_INTERNAL_EXCEPTIONS | INCLUDE_TRACE
|
||||
| 15 => RETHROW_UNSAFE_EXCEPTIONS | RETHROW_INTERNAL_EXCEPTIONS | INCLUDE_TRACE | INCLUDE_DEBUG_MESSAGE
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => env('LIGHTHOUSE_DEBUG', GraphQL\Error\DebugFlag::INCLUDE_DEBUG_MESSAGE | GraphQL\Error\DebugFlag::INCLUDE_TRACE),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Handlers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Register error handlers that receive the Errors that occur during execution
|
||||
| and handle them. You may use this to log, filter or format the errors.
|
||||
| The classes must implement \Nuwave\Lighthouse\Execution\ErrorHandler
|
||||
|
|
||||
*/
|
||||
|
||||
'error_handlers' => [
|
||||
Nuwave\Lighthouse\Execution\AuthenticationErrorHandler::class,
|
||||
Nuwave\Lighthouse\Execution\AuthorizationErrorHandler::class,
|
||||
Nuwave\Lighthouse\Execution\ValidationErrorHandler::class,
|
||||
Nuwave\Lighthouse\Execution\ReportingErrorHandler::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Field Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Register global field middleware directives that wrap around every field.
|
||||
| Execution happens in the defined order, before other field middleware.
|
||||
| The classes must implement \Nuwave\Lighthouse\Support\Contracts\FieldMiddleware
|
||||
|
|
||||
*/
|
||||
|
||||
'field_middleware' => [
|
||||
Nuwave\Lighthouse\Schema\Directives\TrimDirective::class,
|
||||
Nuwave\Lighthouse\Schema\Directives\ConvertEmptyStringsToNullDirective::class,
|
||||
Nuwave\Lighthouse\Schema\Directives\SanitizeDirective::class,
|
||||
Nuwave\Lighthouse\Validation\ValidateDirective::class,
|
||||
Nuwave\Lighthouse\Schema\Directives\TransformArgsDirective::class,
|
||||
Nuwave\Lighthouse\Schema\Directives\SpreadDirective::class,
|
||||
Nuwave\Lighthouse\Schema\Directives\RenameArgsDirective::class,
|
||||
Nuwave\Lighthouse\Schema\Directives\DropArgsDirective::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global ID
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The name that is used for the global id field on the Node interface.
|
||||
| When creating a Relay compliant server, this must be named "id".
|
||||
|
|
||||
*/
|
||||
|
||||
'global_id_field' => 'id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Persisted Queries
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Lighthouse supports Automatic Persisted Queries (APQ), compatible with the
|
||||
| [Apollo implementation](https://www.apollographql.com/docs/apollo-server/performance/apq).
|
||||
| You may set this flag to either process or deny these queries.
|
||||
|
|
||||
*/
|
||||
|
||||
'persisted_queries' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Transactional Mutations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to true, the execution of built-in directives that mutate models
|
||||
| will be wrapped in a transaction to ensure atomicity.
|
||||
| The transaction is committed after the root field resolves,
|
||||
| thus errors in nested fields do not cause a rollback.
|
||||
|
|
||||
*/
|
||||
|
||||
'transactional_mutations' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mass Assignment Protection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to true, mutations will use forceFill() over fill() when populating
|
||||
| a model with arguments in mutation directives. Since GraphQL constrains
|
||||
| allowed inputs by design, mass assignment protection is not needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'force_fill' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Batchload Relations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to true, relations marked with directives like @hasMany or @belongsTo
|
||||
| will be optimized by combining the queries through the BatchLoader.
|
||||
|
|
||||
*/
|
||||
|
||||
'batchload_relations' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shortcut Foreign Key Selection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to true, Lighthouse will shortcut queries where the client selects only the
|
||||
| foreign key pointing to a related model. Only works if the related model's primary
|
||||
| key field is called exactly `id` for every type in your schema.
|
||||
|
|
||||
*/
|
||||
|
||||
'shortcut_foreign_key_selection' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GraphQL Subscriptions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can define GraphQL subscription broadcaster and storage drivers
|
||||
| as well their required configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'subscriptions' => [
|
||||
/*
|
||||
* Determines if broadcasts should be queued by default.
|
||||
*/
|
||||
'queue_broadcasts' => env('LIGHTHOUSE_QUEUE_BROADCASTS', true),
|
||||
|
||||
/*
|
||||
* Determines the queue to use for broadcasting queue jobs.
|
||||
*/
|
||||
'broadcasts_queue_name' => env('LIGHTHOUSE_BROADCASTS_QUEUE_NAME', null),
|
||||
|
||||
/*
|
||||
* Default subscription storage.
|
||||
*
|
||||
* Any Laravel supported cache driver options are available here.
|
||||
*/
|
||||
'storage' => env('LIGHTHOUSE_SUBSCRIPTION_STORAGE', 'redis'),
|
||||
|
||||
/*
|
||||
* Default subscription storage time to live in seconds.
|
||||
*
|
||||
* Indicates how long a subscription can stay active before automatic removal from storage.
|
||||
* Setting this to `null` means the subscriptions are stored forever. This may cause
|
||||
* stale subscriptions to linger indefinitely in case cleanup fails for any reason.
|
||||
*/
|
||||
'storage_ttl' => env('LIGHTHOUSE_SUBSCRIPTION_STORAGE_TTL', null),
|
||||
|
||||
/*
|
||||
* Encrypt subscription channels by prefixing their names with "private-encrypted-"?
|
||||
*/
|
||||
'encrypted_channels' => env('LIGHTHOUSE_SUBSCRIPTION_ENCRYPTED', false),
|
||||
|
||||
/*
|
||||
* Default subscription broadcaster.
|
||||
*/
|
||||
'broadcaster' => env('LIGHTHOUSE_BROADCASTER', 'pusher'),
|
||||
|
||||
/*
|
||||
* Subscription broadcasting drivers with config options.
|
||||
*/
|
||||
'broadcasters' => [
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
'echo' => [
|
||||
'driver' => 'echo',
|
||||
'connection' => env('LIGHTHOUSE_SUBSCRIPTION_REDIS_CONNECTION', 'default'),
|
||||
'routes' => Nuwave\Lighthouse\Subscriptions\SubscriptionRouter::class.'@echoRoutes',
|
||||
],
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'connection' => 'pusher',
|
||||
'routes' => Nuwave\Lighthouse\Subscriptions\SubscriptionRouter::class.'@pusher',
|
||||
],
|
||||
'reverb' => [
|
||||
'driver' => 'pusher',
|
||||
'connection' => 'reverb',
|
||||
'routes' => Nuwave\Lighthouse\Subscriptions\SubscriptionRouter::class.'@reverb',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Should the subscriptions extension be excluded when the response has no subscription channel?
|
||||
* This optimizes performance by sending less data.
|
||||
* Clients must anticipate this behavior.
|
||||
*/
|
||||
'exclude_empty' => env('LIGHTHOUSE_SUBSCRIPTION_EXCLUDE_EMPTY', true),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Defer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configuration for the experimental @defer directive support.
|
||||
|
|
||||
*/
|
||||
|
||||
'defer' => [
|
||||
/*
|
||||
* Maximum number of nested fields that can be deferred in one query.
|
||||
* Once reached, remaining fields will be resolved synchronously.
|
||||
* 0 means unlimited.
|
||||
*/
|
||||
'max_nested_fields' => 0,
|
||||
|
||||
/*
|
||||
* Maximum execution time for deferred queries in milliseconds.
|
||||
* Once reached, remaining fields will be resolved synchronously.
|
||||
* 0 means unlimited.
|
||||
*/
|
||||
'max_execution_ms' => 0,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Apollo Federation
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Lighthouse can act as a federated service: https://www.apollographql.com/docs/federation/federation-spec.
|
||||
|
|
||||
*/
|
||||
|
||||
'federation' => [
|
||||
/*
|
||||
* Location of resolver classes when resolving the `_entities` field.
|
||||
*/
|
||||
'entities_resolver_namespace' => 'App\\GraphQL\\Entities',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Tracing
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configuration for tracing support.
|
||||
|
|
||||
*/
|
||||
|
||||
'tracing' => [
|
||||
/*
|
||||
* Driver used for tracing.
|
||||
*
|
||||
* Accepts the fully qualified class name of a class that implements Nuwave\Lighthouse\Tracing\Tracing.
|
||||
* Lighthouse provides:
|
||||
* - Nuwave\Lighthouse\Tracing\ApolloTracing\ApolloTracing::class
|
||||
* - Nuwave\Lighthouse\Tracing\FederatedTracing\FederatedTracing::class
|
||||
*
|
||||
* In Lighthouse v7 the default will be changed to 'Nuwave\Lighthouse\Tracing\FederatedTracing\FederatedTracing::class'.
|
||||
*/
|
||||
'driver' => Nuwave\Lighthouse\Tracing\ApolloTracing\ApolloTracing::class,
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user