From 3401d93f49291f469418a79aa959d06a35e6d59a Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Mon, 4 Dec 2023 21:15:18 +0000 Subject: [PATCH] Match standard terminology Uses by Fly.io, Heroku, Flask etc. --- Makefile | 2 +- scripts/smoke-test.sh | 2 +- src/Config.ts | 2 +- src/Redis.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0300570..ec9b8c9 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ smoke-test: build-image start-services REDIS_PORT=$(shell docker compose port redis 6379 | awk -F":" '{print $$2}') scripts/smoke-test.sh ${IMAGE_TAG} start: node_modules start-services - REDIS_URI=redis://$(shell docker compose port redis 6379) npx tsx --require dotenv/config src + REDIS_URL=redis://$(shell docker compose port redis 6379) npx tsx --require dotenv/config src start-services: docker compose up --detach diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index abbf660..15faef9 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -21,7 +21,7 @@ function finish() { trap finish EXIT echo "Starting the container" -container=$(docker run --env SLACK_ACCESS_TOKEN=token --env REDIS_URI="redis://host.docker.internal:$REDIS_PORT" --add-host=host.docker.internal:host-gateway --detach "$1") +container=$(docker run --env SLACK_ACCESS_TOKEN=token --env REDIS_URL="redis://host.docker.internal:$REDIS_PORT" --add-host=host.docker.internal:host-gateway --detach "$1") timeout --foreground 20 bash << EOT while true; do diff --git a/src/Config.ts b/src/Config.ts index 65c9b51..3d5ade2 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -8,7 +8,7 @@ const slackApiConfig = Config.nested( ) const redisConfig = Config.nested( - Config.mapAttempt(Config.string('URI'), uri => ({ uri: new URL(uri) }) satisfies RedisConfig), + Config.mapAttempt(Config.string('URL'), url => ({ url: new URL(url) }) satisfies RedisConfig), 'REDIS', ) diff --git a/src/Redis.ts b/src/Redis.ts index 82d444c..7d16d24 100644 --- a/src/Redis.ts +++ b/src/Redis.ts @@ -4,7 +4,7 @@ import IoRedis from 'ioredis' export type Redis = IoRedis.Redis export interface RedisConfig { - readonly uri: URL + readonly url: URL } export const Redis = Context.Tag('IoRedis/Redis') @@ -21,7 +21,7 @@ export const layer: Layer.Layer = Layer.scoped( Effect.gen(function* (_) { const config = yield* _(RedisConfig) - return new IoRedis.Redis(config.uri.href) + return new IoRedis.Redis(config.url.href) }), redis => Effect.sync(() => redis.disconnect()), ),