From d34cb7ec3976d51217407109cb8e399c7f4375da Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 6 Nov 2024 08:14:47 -0700 Subject: [PATCH] fix: also change DATABASE_ID to ELECTRIC_DATABASE_ID (#1934) Missed this when working on https://github.com/electric-sql/electric/issues/1927 --- .github/workflows/ts_test.yml | 4 ++-- integration-tests/tests/_macros.luxinc | 2 +- packages/react-hooks/test/support/global-setup.ts | 2 +- packages/sync-service/.env.dev | 2 +- packages/sync-service/.env.test | 2 +- packages/sync-service/config/runtime.exs | 4 ++-- packages/typescript-client/test/support/global-setup.ts | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ts_test.yml b/.github/workflows/ts_test.yml index 25d6108a4f..16d8bb8702 100644 --- a/.github/workflows/ts_test.yml +++ b/.github/workflows/ts_test.yml @@ -71,7 +71,7 @@ jobs: run: working-directory: ${{ matrix.package_dir }} env: - DATABASE_ID: ci_test_tenant + ELECTRIC_DATABASE_ID: ci_test_tenant steps: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 @@ -113,7 +113,7 @@ jobs: mix run --no-halt & wait-on: | - http-get://localhost:3000/v1/health?database_id=${{ env.DATABASE_ID }} + http-get://localhost:3000/v1/health?database_id=${{ env.ELECTRIC_DATABASE_ID }} tail: true log-output-resume: stderr diff --git a/integration-tests/tests/_macros.luxinc b/integration-tests/tests/_macros.luxinc index 2e8dea1257..ec2f3d7ecc 100644 --- a/integration-tests/tests/_macros.luxinc +++ b/integration-tests/tests/_macros.luxinc @@ -91,7 +91,7 @@ [shell $shell_name] -$fail_pattern - !DATABASE_ID=integration_test_tenant DATABASE_URL=$database_url ELECTRIC_PORT=$port $env ../scripts/electric_dev.sh + !ELECTRIC_DATABASE_ID=integration_test_tenant DATABASE_URL=$database_url ELECTRIC_PORT=$port $env ../scripts/electric_dev.sh [endmacro] [macro teardown] diff --git a/packages/react-hooks/test/support/global-setup.ts b/packages/react-hooks/test/support/global-setup.ts index 5f494e74ea..c6614ca817 100644 --- a/packages/react-hooks/test/support/global-setup.ts +++ b/packages/react-hooks/test/support/global-setup.ts @@ -3,7 +3,7 @@ import { makePgClient } from './test-helpers' const url = process.env.ELECTRIC_URL ?? `http://localhost:3000` const proxyUrl = process.env.ELECTRIC_PROXY_CACHE_URL ?? `http://localhost:3002` -const databaseId = process.env.DATABASE_ID ?? `test_tenant` +const databaseId = process.env.ELECTRIC_DATABASE_ID ?? `test_tenant` // name of proxy cache container to execute commands against, // see docker-compose.yml that spins it up for details diff --git a/packages/sync-service/.env.dev b/packages/sync-service/.env.dev index 062e482b64..5aaaa42a13 100644 --- a/packages/sync-service/.env.dev +++ b/packages/sync-service/.env.dev @@ -5,6 +5,6 @@ ELECTRIC_CACHE_MAX_AGE=1 ELECTRIC_CACHE_STALE_AGE=3 # using a small chunk size of 10kB for dev to speed up tests ELECTRIC_LOG_CHUNK_BYTES_THRESHOLD=10000 -DATABASE_ID=test_tenant +ELECTRIC_DATABASE_ID=test_tenant # configuring a second database for multi-tenancy integration testing OTHER_DATABASE_URL=postgresql://postgres:password@localhost:54322/electric?sslmode=disable diff --git a/packages/sync-service/.env.test b/packages/sync-service/.env.test index 528bac35cf..439f18af07 100644 --- a/packages/sync-service/.env.test +++ b/packages/sync-service/.env.test @@ -1,3 +1,3 @@ LOG_LEVEL=info DATABASE_URL=postgresql://postgres:password@localhost:54321/postgres?sslmode=disable -DATABASE_ID=test_tenant +ELECTRIC_DATABASE_ID=test_tenant diff --git a/packages/sync-service/config/runtime.exs b/packages/sync-service/config/runtime.exs index 41d1684e3b..90cabe9766 100644 --- a/packages/sync-service/config/runtime.exs +++ b/packages/sync-service/config/runtime.exs @@ -85,7 +85,7 @@ config :opentelemetry, processors: [otel_batch_processor, otel_simple_processor] |> Enum.reject(&is_nil/1) database_url = env!("DATABASE_URL", :string, nil) -default_tenant = env!("DATABASE_ID", :string, nil) +default_tenant = env!("ELECTRIC_DATABASE_ID", :string, nil) case {database_url, default_tenant} do {nil, nil} -> @@ -93,7 +93,7 @@ case {database_url, default_tenant} do :ok {nil, _} -> - raise "DATABASE_URL must be provided when DATABASE_ID is set" + raise "DATABASE_URL must be provided when ELECTRIC_DATABASE_ID is set" {_, _} -> # A default tenant is provided diff --git a/packages/typescript-client/test/support/global-setup.ts b/packages/typescript-client/test/support/global-setup.ts index 8eb55f6d4a..634f0c2ea4 100644 --- a/packages/typescript-client/test/support/global-setup.ts +++ b/packages/typescript-client/test/support/global-setup.ts @@ -4,7 +4,7 @@ import { Client } from 'pg' const url = process.env.ELECTRIC_URL ?? `http://localhost:3000` const proxyUrl = process.env.ELECTRIC_PROXY_CACHE_URL ?? `http://localhost:3002` -const databaseId = process.env.DATABASE_ID ?? `test_tenant` +const databaseId = process.env.ELECTRIC_DATABASE_ID ?? `test_tenant` const otherDatabaseId = `other_test_tenant` const otherDatabaseUrl = process.env.OTHER_DATABASE_URL ??