Promise.map(config.graphql.remotes, (async (uri: string) => { logger.info(`loading remote schema from { ${uri} }`); const fetcher = createApolloFetch({ uri }); const schema = makeRemoteExecutableSchema({ schema: await introspectSchema(fetcher), fetcher, }); return schema; }))
private async getIntrospectSchema( microservice: MicroserviceInterface ): Promise<GraphQLSchema> { const headers = { authorization: '' }; if (this.configAuth.authorization) { const Authorization = Container.get<{ sign: (params) => string }>( this.configAuth.authorization ); headers.authorization = Authorization.sign({ email: microservice.name, id: -1, scope: ['ADMIN'], }); } const makeDatabaseServiceLink = () => createHttpLink({ uri: microservice.link, fetch, headers }); return makeRemoteExecutableSchema({ schema: await introspectSchema(makeDatabaseServiceLink()), link: makeDatabaseServiceLink(), }); }
private async getIntrospectSchema( microservice: MicroserviceInterface ): Promise<GraphQLSchema> { const headers = { authorization: '' }; if (this.configAuth.authorization) { const Authorization = Container.get<{ sign: (params) => string }>( this.configAuth.authorization ); headers.authorization = Authorization.sign({ email: microservice.name, id: -1, scope: ['ADMIN'], }); } const makeDatabaseServiceLink = () => createHttpLink({ uri: microservice.link, fetch, headers }); return makeRemoteExecutableSchema({ schema: await introspectSchema(makeDatabaseServiceLink()), link: makeDatabaseServiceLink(), }); }