From 20d9a5a9e09b84cb2f9327ed04329755c5d24567 Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:14:58 +0100 Subject: [PATCH] Use Dgraph envvars for request --- lib/request.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/request.ts b/lib/request.ts index d3e48f3..de058b1 100644 --- a/lib/request.ts +++ b/lib/request.ts @@ -29,7 +29,9 @@ type RequestGraphQlJsonConfig = Omit & { body: { query: str * https://docs.fauna.com/fauna/current/learn/understanding/region_groups */ export const requestGraphQlJson = (config: RequestGraphQlJsonConfig) => - requestJson(process.env.FAUNADB_URL || "https://graphql.fauna.com/graphql", { + requestJson(process.env.DGRAPH_URL || "", { ...config, - headers: { Authorization: `Bearer ${process.env.FAUNADB_SECRET}`, ...config.headers }, + headers: process.env.DGRAPH_SECRET + ? { "X-Auth-Token": process.env.DGRAPH_SECRET, ...config.headers } + : config.headers, });