fixed env variable not working.
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 5m58s
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 5m58s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Composer } from "grammy";
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import { urql } from "#root/main.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
|
||||
const composer = new Composer<Context>();
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import metaLinkCheck from "#root/lib/metaLinkCheck.js";
|
||||
import twitterLinkCheck from "#root/lib/twitterLinkCheck.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import { urql } from "#root/main.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
import addGroup from "#root/lib/graphql/mutations/addGroupMutation.js";
|
||||
import incrementGroup from "#root/lib/graphql/mutations/incrementGroupMutation.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Composer } from "grammy";
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import { urql } from "#root/main.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
|
||||
const composer = new Composer<Context>();
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Composer } from "grammy";
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import { metaRegex } from "#root/lib/metaLinkCheck.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import { urql } from "#root/main.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
import addGroup from "#root/lib/graphql/mutations/addGroupMutation.js";
|
||||
import incrementGroup from "#root/lib/graphql/mutations/incrementGroupMutation.js";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Composer } from "grammy";
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import { twitterRegex } from "#root/lib/twitterLinkCheck.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import { urql } from "#root/main.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
import addGroup from "#root/lib/graphql/mutations/addGroupMutation.js";
|
||||
import incrementGroup from "#root/lib/graphql/mutations/incrementGroupMutation.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Composer } from "grammy";
|
||||
import type { Context } from "#root/bot/context.js";
|
||||
import { logHandle } from "#root/bot/helpers/logging.js";
|
||||
import urql from "#root/lib/urql.js";
|
||||
import { urql } from "#root/main.js";
|
||||
import increment from "#root/lib/graphql/mutations/incrimentMutation.js";
|
||||
|
||||
const composer = new Composer<Context>();
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Client, cacheExchange, fetchExchange } from "@urql/core";
|
||||
|
||||
const urql = new Client({
|
||||
url: process.env.GRAPHQL_URL || "",
|
||||
exchanges: [cacheExchange, fetchExchange],
|
||||
fetchOptions: {
|
||||
headers: {
|
||||
"x-api-key": process.env?.GRAPHQL_API_TOKEN || ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default urql;
|
||||
11
src/main.ts
11
src/main.ts
@@ -8,6 +8,7 @@ import { config } from "#root/config.js";
|
||||
import { logger } from "#root/logger.js";
|
||||
import { createServer, createServerManager } from "#root/server/index.js";
|
||||
import { run } from "@grammyjs/runner";
|
||||
import { Client, cacheExchange, fetchExchange } from "@urql/core";
|
||||
|
||||
async function startPolling(config: PollingConfig) {
|
||||
const bot = createBot(config.botToken, {
|
||||
@@ -112,3 +113,13 @@ function onShutdown(cleanUp: () => Promise<void>) {
|
||||
process.on("SIGINT", handleShutdown);
|
||||
process.on("SIGTERM", handleShutdown);
|
||||
}
|
||||
|
||||
export const urql = new Client({
|
||||
url: process.env.GRAPHQL_URL || "",
|
||||
exchanges: [cacheExchange, fetchExchange],
|
||||
fetchOptions: {
|
||||
headers: {
|
||||
"x-api-key": process.env?.GRAPHQL_API_TOKEN || ""
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user