How to use the apollo-language-server.getServiceFromKey function in apollo-language-server

To help you get started, we’ve selected a few apollo-language-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apollographql / apollo-tooling / packages / apollo / src / Command.ts View on Github external
protected async createConfig(flags: Flags) {
    const service = flags.key ? getServiceFromKey(flags.key) : undefined;
    const config = await loadConfig({
      configPath: flags.config && parse(resolve(flags.config)).dir,
      configFileName: flags.config,
      name: service,
      type: this.type
    });

    if (!config) {
      this.error("A config failed to load, so the command couldn't be run");
      this.exit(1);
      return;
    }

    config.tag = flags.tag || config.tag || "current";
    //  flag overrides
    config.setDefaults({
github apollographql / apollo-tooling / packages / apollo / src / NewCommand.tsx View on Github external
useEffect(() => {
        const oclif = this.parse(ApolloCommand);
        const service = oclif.flags.key
          ? getServiceFromKey(oclif.flags.key)
          : undefined;
        this.loadConfigFromFlags(oclif.flags, service)
          .then(config => {
            if (!config) throw new Error("Could not load config");
            const client = new ApolloClient({
              name: "Apollo CLI",
              version,
              link: new HttpLink({
                uri: config.engine.endpoint,
                headers: {
                  "x-api-key": config.engine.apiKey || service,
                  "apollo-client-reference-id": referenceID
                },
                fetch: fetch as any
              }),
              cache: new InMemoryCache()