@@ -3,60 +3,54 @@ import http from 'http';
33import { ApolloServer } from 'apollo-server-express' ;
44import { graphqlUploadExpress } from 'graphql-upload' ;
55import { SubscriptionServer } from 'subscriptions-transport-ws' ;
6- import { default as WebSocket } from 'ws' ;
7- import ws from 'ws' ;
6+ import WebSocket from 'ws' ;
87import { execute , subscribe } from 'graphql' ;
98import createWordpressSchema from './remotes/wordpress' ;
109import createContentfulSchema from './remotes/contentful' ;
1110import createDiscordPostsSchema from './remotes/discordPosts' ;
1211import createAuth0Schema from './remotes/auth0' ;
13- import createGithubSchema from './remotes/github' ;
1412import createShowcaseSchema from './remotes/showcase' ;
1513import createCalendarSchema from './remotes/calendar' ;
1614import createLabsSchema from './remotes/labs' ;
1715import createAdvisorsSchema from './remotes/advisors' ;
1816import createTwitchSchema from './remotes/twitch' ;
1917import createGeoSchema from './remotes/geo' ;
2018import createClearSchema from "./remotes/clear" ;
21- import { addAuthContext , addWsAuthContext } from './auth ' ;
19+ import createAccountSchema from './remotes/account ' ;
2220import { weave } from './schema' ;
2321import log from './plugins/log' ;
2422
2523const port = process . env . PORT || 4000 ;
2624
2725async function buildSchema ( ) {
2826 console . log ( 'Fetching sub-schemas...' ) ;
29- const [ blog , showYourWork , showcase , calendar , labs , advisors , clear , cms , account , geo , twitch , github ] =
30- await Promise . all ( [
31- await createWordpressSchema ( process . env . WORDPRESS_URL || 'https://wp.codeday.org/graphql' ) ,
32- await createDiscordPostsSchema ( process . env . SHOWYOURWORK_URL || 'http://discord-posts.codeday.cloud' ) ,
33- await createShowcaseSchema (
34- process . env . SHOWCASE_URL || 'http://showcase-gql.codeday.cloud/graphql' ,
35- process . env . SHOWCASE_WS || 'ws://showcase-gql.codeday.cloud/graphql'
36- ) ,
37- await createCalendarSchema ( process . env . CALENDAR_URL || 'http://calendar-gql.codeday.cloud/graphql' ) ,
38- await createLabsSchema ( process . env . LABS_URL || 'http://labs-gql.codeday.cloud/graphql' ) ,
39- await createAdvisorsSchema ( process . env . ADVISORS_URL || 'http://advisors-gql.codeday.cloud/graphql' ) ,
40- await createClearSchema ( process . env . CLEAR_URL || 'http://clear-gql.codeday.cloud/graphql' ) ,
41- await createContentfulSchema ( 'd5pti1xheuyu' , process . env . CONTENTFUL_TOKEN ) ,
42- await createAuth0Schema (
43- process . env . AUTH0_DOMAIN ,
44- process . env . AUTH0_CLIENT_ID ,
45- process . env . AUTH0_CLIENT_SECRET
46- ) ,
47- await createGeoSchema (
48- process . env . MAXMIND_ACCOUNT ,
49- process . env . MAXMIND_KEY
50- ) ,
51- await createTwitchSchema (
52- process . env . TWITCH_CHANNEL ,
53- process . env . TWITCH_CLIENT_ID ,
54- process . env . TWITCH_CLIENT_SECRET
55- ) ,
56- await createGithubSchema (
57- process . env . GITHUB_TOKEN ,
58- ) ,
59- ] ) ;
27+ const [ blog , showYourWork , showcase , calendar , labs , advisors , clear , cms , account , geo , twitch ] = await Promise . all ( [
28+ await createWordpressSchema ( process . env . WORDPRESS_URL || 'https://wp.codeday.org/graphql' ) ,
29+ await createDiscordPostsSchema ( process . env . SHOWYOURWORK_URL || 'http://discord-posts.codeday.cloud' ) ,
30+ await createShowcaseSchema (
31+ process . env . SHOWCASE_URL || 'http://showcase-gql.codeday.cloud/graphql' ,
32+ process . env . SHOWCASE_WS || 'ws://showcase-gql.codeday.cloud/graphql'
33+ ) ,
34+ await createCalendarSchema ( process . env . CALENDAR_URL || 'http://calendar-gql.codeday.cloud/graphql' ) ,
35+ await createLabsSchema ( process . env . LABS_URL || 'http://labs-gql.codeday.cloud/graphql' ) ,
36+ await createAdvisorsSchema ( process . env . ADVISORS_URL || 'http://advisors-gql.codeday.cloud/graphql' ) ,
37+ await createClearSchema ( process . env . CLEAR_URL || 'http://clear-gql.codeday.cloud/graphql' ) ,
38+ await createContentfulSchema ( 'd5pti1xheuyu' , process . env . CONTENTFUL_TOKEN ) ,
39+ await createAuth0Schema (
40+ process . env . AUTH0_DOMAIN ,
41+ process . env . AUTH0_CLIENT_ID ,
42+ process . env . AUTH0_CLIENT_SECRET
43+ ) ,
44+ await createGeoSchema (
45+ process . env . MAXMIND_ACCOUNT ,
46+ process . env . MAXMIND_KEY
47+ ) ,
48+ await createTwitchSchema (
49+ process . env . TWITCH_CHANNEL ,
50+ process . env . TWITCH_CLIENT_ID ,
51+ process . env . TWITCH_CLIENT_SECRET
52+ ) ,
53+ ] ) ;
6054 console . log ( '...sub-schemas fetched.' ) ;
6155
6256 return weave ( {
@@ -92,7 +86,6 @@ export default async () => {
9286 context : ( { req } ) => ( {
9387 headers : req ?. headers ,
9488 req,
95- ...addAuthContext ( req || { } ) ,
9689 } ) ,
9790 } ) ;
9891
@@ -117,9 +110,6 @@ export default async () => {
117110 schema,
118111 execute,
119112 subscribe,
120- onConnect : ( connectionParams , webSocket ) => {
121- return addWsAuthContext ( connectionParams )
122- }
123113 } , { server, path : '/subscriptions' } ) ;
124114 console . log ( `Listening on http://0.0.0.0:${ port } ` ) ;
125115 } ) ;
0 commit comments