Skip to content
Merged
5 changes: 4 additions & 1 deletion javascript/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { CodegenConfig } from "@graphql-codegen/cli";
import { env } from "node:process";

const graphql_engine_hostname: string = env["HASURA_GRAPHQL_SERVER_HOSTNAME"] || "graphql_engine";
const graphqlEngineUrl: string = "http://" + graphql_engine_hostname + ":8080/v1/graphql";

const config: CodegenConfig = {
schema: [
{
"http://graphql_engine:8080/v1/graphql": {
[graphqlEngineUrl]: {
headers: {
"x-hasura-admin-secret": env["HASURA_GRAPHQL_ADMIN_SECRET"],
} as any,
Expand Down
4 changes: 3 additions & 1 deletion javascript/src/collab_server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ const HANDLERS: Map<string, ModelHandler<any>> = new Map(HANDLERS_ARR);

// Graphql Client

const graphql_engine_hostname: string = env["HASURA_GRAPHQL_SERVER_HOSTNAME"] || "graphql_engine";

const httpLink = createHttpLink({
uri: "http://graphql_engine:8080/v1/graphql",
uri: "http://" + graphql_engine_hostname + ":8080/v1/graphql"
});

const authLink = setContext((_, { headers }) => {
Expand Down
2 changes: 2 additions & 0 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ services:
name: ghostwriter_frontend
environment:
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_GRAPHQL_ADMIN_SECRET}
- HASURA_GRAPHQL_SERVER_HOSTNAME=${HASURA_GRAPHQL_SERVER_HOSTNAME}

collab-server:
build:
Expand All @@ -173,6 +174,7 @@ services:
environment:
- HASURA_ACTION_SECRET=${HASURA_GRAPHQL_ACTION_SECRET}
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_GRAPHQL_ADMIN_SECRET}
- HASURA_GRAPHQL_SERVER_HOSTNAME=${HASURA_GRAPHQL_SERVER_HOSTNAME}
ports:
- "8001:8000" # HTTP. Also reverse-proxied through nginx
- "9229:9229" # nodejs debugging: https://nodejs.org/en/learn/getting-started/debugging
Expand Down
1 change: 1 addition & 0 deletions production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,4 @@ services:
environment:
- HASURA_ACTION_SECRET=${HASURA_GRAPHQL_ACTION_SECRET}
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_GRAPHQL_ADMIN_SECRET}
- HASURA_GRAPHQL_SERVER_HOSTNAME=${HASURA_GRAPHQL_SERVER_HOSTNAME}
Loading