Skip to content

Commit 0232ffb

Browse files
committed
Make schema configurable, export config and default schema
1 parent 19a9ba2 commit 0232ffb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

config/config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@
2121
|
2222
*/
2323
'client_secret' => env('PASSPORT_CLIENT_SECRET', null),
24+
/*
25+
|--------------------------------------------------------------------------
26+
| GraphQL schema
27+
|--------------------------------------------------------------------------
28+
|
29+
| File path of the GraphQL schema to be used, defaults to null so it uses
30+
| the default location
31+
|
32+
*/
33+
'schema' => null
2434
];

src/Providers/LighthouseGraphQLPassportServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public function register()
2121
app('events')->listen(
2222
BuildingAST::class,
2323
function (BuildingAST $buildingAST): string {
24+
if(config('lighthouse-graphql-passport.schema')) {
25+
return file_get_contents(config('lighthouse-graphql-passport.schema'));
26+
}
2427
return file_get_contents(__DIR__."/../../graphql/auth.graphql");
2528
}
2629
);
@@ -36,6 +39,7 @@ protected function registerConfig()
3639
$this->publishes(
3740
[
3841
__DIR__.'/../../config/config.php' => config_path('lighthouse-graphql-passport.php'),
42+
__DIR__.'/../../graphql/auth.graphql' => base_path('graphql/auth.graphql'),
3943
]
4044
);
4145
$this->mergeConfigFrom(

0 commit comments

Comments
 (0)