Hive ConsoleSelf hosting
Client & CLI Configuration
By default, the Hive CLI and Hive Client SDK connect to the hosted Hive Console version. In order to connect to a local Hive server, you need to configure both the client and SDK.
Configuring the Client
Instantiate your Gateway or client to point to the self-hosting endpoints.
import { defineConfig } from "@graphql-hive/gateway";
const config = defineConfig({
reporting: {
type: "hive",
selfHosting: {
graphqlEndpoint: "http://localhost:8082/graphql",
usageEndpoint: "http://localhost:8081",
applicationUrl: "http://localhost:8080/",
},
},
});usage_reporting:
endpoint: http://localhost:8081import { createHive } from "@graphql-hive/core";
const hive = createHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: "http://localhost:8082/graphql",
usageEndpoint: "http://localhost:8081",
applicationUrl: "http://localhost:8080/",
},
usage: true,
});import { createYoga } from "graphql-yoga";
import { useHive } from "@graphql-hive/yoga";
const yoga = createYoga({
plugins: [
useHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: "http://localhost:8082/graphql",
usageEndpoint: "http://localhost:8081",
applicationUrl: "http://localhost:8080/",
},
usage: true,
}),
],
});import { createYoga } from "@apollo/server";
import { useHive } from "@graphql-hive/apollo";
const apollo = new ApolloServer({
plugins: [
useHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: "http://localhost:8082/graphql",
usageEndpoint: "http://localhost:8081",
applicationUrl: "http://localhost:8080/",
},
usage: true,
}),
],
});import { createYoga } from "graphql-yoga";
import { useHive } from "@graphql-hive/envelop";
const yoga = createYoga({
plugins: [
useHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: "http://localhost:8082/graphql",
usageEndpoint: "http://localhost:8081",
applicationUrl: "http://localhost:8080/",
},
usage: true,
}),
],
});Configuring the CLI
Place a hive.json file within the root of your project.
{
"registry": {
"endpoint": "http://localhost:8082/graphql"
}
}