Drop unnecessary defensive code + revert noise
This commit is contained in:
@@ -64,7 +64,3 @@ SVIX_API_KEY=
|
||||
# ANTHROPIC
|
||||
# This is used to generate singular / plural names for your features, which are used when in the dashboard and when you use Autumn UI components
|
||||
ANTHROPIC_API_KEY=
|
||||
|
||||
# TINYBIRD
|
||||
# ClickHouse endpoint for the us-east workspace (primary after cutover).
|
||||
TINYBIRD_US_EAST_CLICKHOUSE_URL=
|
||||
|
||||
25
server/src/external/tinybird/initClickhouse.ts
vendored
25
server/src/external/tinybird/initClickhouse.ts
vendored
@@ -1,30 +1,11 @@
|
||||
import { type ClickHouseClient, createClient } from "@clickhouse/client";
|
||||
|
||||
// ClickHouse URL is different from API URL
|
||||
// API: https://api.europe-west2.gcp.tinybird.co
|
||||
// ClickHouse: https://europe-west2.gcp.clickhouse.tinybird.co
|
||||
const primaryClickhouseUrl = process.env.TINYBIRD_US_EAST_CLICKHOUSE_URL;
|
||||
const primaryToken = process.env.TINYBIRD_US_EAST_TOKEN;
|
||||
|
||||
const safeOrigin = (url: string): string | null => {
|
||||
try {
|
||||
return new URL(url).origin;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const legacyClickhouseUrl = process.env.TINYBIRD_CLICKHOUSE_URL;
|
||||
const legacyOrigin = legacyClickhouseUrl
|
||||
? safeOrigin(legacyClickhouseUrl)
|
||||
: null;
|
||||
const primaryOrigin = primaryClickhouseUrl
|
||||
? safeOrigin(primaryClickhouseUrl)
|
||||
: null;
|
||||
if (legacyOrigin && primaryOrigin && legacyOrigin !== primaryOrigin) {
|
||||
console.warn(
|
||||
`[Tinybird ClickHouse] Ignoring legacy TINYBIRD_CLICKHOUSE_URL (${legacyClickhouseUrl}) — ` +
|
||||
`using TINYBIRD_US_EAST_CLICKHOUSE_URL (${primaryClickhouseUrl}) instead.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (primaryClickhouseUrl && primaryToken) {
|
||||
console.log(
|
||||
`[Tinybird ClickHouse] Configured with URL: ${primaryClickhouseUrl}`,
|
||||
|
||||
18
server/src/external/tinybird/initTinybirdV2.ts
vendored
18
server/src/external/tinybird/initTinybirdV2.ts
vendored
@@ -11,29 +11,11 @@ const secondaryConfig =
|
||||
? { baseUrl: secondaryApiUrl, token: secondaryToken }
|
||||
: null;
|
||||
|
||||
const safeOrigin = (url: string): string | null => {
|
||||
try {
|
||||
return new URL(url).origin;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const tinybirdSecondaryApi = secondaryConfig
|
||||
? createTinybirdApi(secondaryConfig)
|
||||
: null;
|
||||
|
||||
if (secondaryConfig) {
|
||||
const primaryUrl = process.env.TINYBIRD_US_EAST_API_URL;
|
||||
const primaryOrigin = primaryUrl ? safeOrigin(primaryUrl) : null;
|
||||
const secondaryOrigin = safeOrigin(secondaryConfig.baseUrl);
|
||||
if (primaryOrigin && secondaryOrigin && primaryOrigin === secondaryOrigin) {
|
||||
console.warn(
|
||||
`[Tinybird] WARNING: primary and secondary resolve to the same workspace (${primaryOrigin}). ` +
|
||||
"The events datasource is plain MergeTree with no dedup, so each ingest " +
|
||||
"will write the same row twice. Verify Infisical TINYBIRD_US_EAST_API_URL vs TINYBIRD_API_URL.",
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`[Tinybird] secondary dual-write configured with URL: ${secondaryConfig.baseUrl}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user