use envs for secrets

This commit is contained in:
Avraham Sakal
2024-07-05 15:45:29 -04:00
parent cb7dbc29e8
commit 37363030ec
7 changed files with 23 additions and 40 deletions
+9 -6
View File
@@ -1,13 +1,16 @@
import _ from "../env.js";
import { createClient as createClickhouseClient } from "@clickhouse/client";
import type { DataFormat } from "@clickhouse/client";
import { Env } from "@humanwhocodes/env";
const env = new Env();
const { CLICKHOUSE_USER, CLICKHOUSE_PASS } = env.required;
const CLICKHOUSE_HOST = env.get("CLICKHOUSE_HOST", "http://localhost:8123");
// prevent from tree-shaking:
console.log(_);
export const clickhouse = createClickhouseClient({
host: process.env.CLICKHOUSE_HOST || "http://localhost:8123",
username: "avraham",
password: "buginoo",
host: CLICKHOUSE_HOST,
username: CLICKHOUSE_USER,
password: CLICKHOUSE_PASS,
});
export async function query<T>(
+6 -1
View File
@@ -1,7 +1,12 @@
// import pThrottle from "p-throttle";
import pRetry from "p-retry";
import { Env } from "@humanwhocodes/env";
const apiKey = "H95NTsatM1iTWLUwDLxM2J5zhUVYdCEz";
const env = new Env();
const { POLYGON_API_KEY } = env.required;
const apiKey = POLYGON_API_KEY;
// export const getApiKey = pThrottle({ limit: 5, interval: 60000 })(() => apiKey);
export const getApiKey = () => apiKey;