From 0acde23c46b5d04c19da317d7887c6f517628153 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 16 May 2024 08:08:36 -0500 Subject: [PATCH 1/2] Port 8000 -> 4036 in all the places --- installation/ditto.conf | 2 +- src/config.ts | 2 +- src/storages/EventsDB.test.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/installation/ditto.conf b/installation/ditto.conf index 2a491734..afdf65c0 100644 --- a/installation/ditto.conf +++ b/installation/ditto.conf @@ -3,7 +3,7 @@ # Edit this file to change occurences of "example.com" to your own domain. upstream ditto { - server 127.0.0.1:8000; + server 127.0.0.1:4036; } upstream ipfs_gateway { diff --git a/src/config.ts b/src/config.ts index 5a30c0e6..6107547e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -55,7 +55,7 @@ class Conf { } /** Origin of the Ditto server, including the protocol and port. */ static get localDomain() { - return Deno.env.get('LOCAL_DOMAIN') || 'http://localhost:8000'; + return Deno.env.get('LOCAL_DOMAIN') || 'http://localhost:4036'; } /** URL to an external Nostr viewer. */ static get externalDomain() { diff --git a/src/storages/EventsDB.test.ts b/src/storages/EventsDB.test.ts index d1986b7d..10f0d117 100644 --- a/src/storages/EventsDB.test.ts +++ b/src/storages/EventsDB.test.ts @@ -33,15 +33,15 @@ Deno.test('query events with domain search filter', async () => { await eventsDB.event(event1); assertEquals(await eventsDB.query([{}]), [event1]); - assertEquals(await eventsDB.query([{ search: 'domain:localhost:8000' }]), []); + assertEquals(await eventsDB.query([{ search: 'domain:localhost:4036' }]), []); assertEquals(await eventsDB.query([{ search: '' }]), [event1]); await kysely .insertInto('pubkey_domains') - .values({ pubkey: event1.pubkey, domain: 'localhost:8000', last_updated_at: event1.created_at }) + .values({ pubkey: event1.pubkey, domain: 'localhost:4036', last_updated_at: event1.created_at }) .execute(); - assertEquals(await eventsDB.query([{ kinds: [1], search: 'domain:localhost:8000' }]), [event1]); + assertEquals(await eventsDB.query([{ kinds: [1], search: 'domain:localhost:4036' }]), [event1]); assertEquals(await eventsDB.query([{ kinds: [1], search: 'domain:example.com' }]), []); }); From 4b07f2a12a6b31fcfd062e477e35f58811afba75 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 16 May 2024 08:10:13 -0500 Subject: [PATCH 2/2] Actually, set default LOCAL_DOMAIN based on PORT --- src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index 6107547e..6fe62b9e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -55,7 +55,7 @@ class Conf { } /** Origin of the Ditto server, including the protocol and port. */ static get localDomain() { - return Deno.env.get('LOCAL_DOMAIN') || 'http://localhost:4036'; + return Deno.env.get('LOCAL_DOMAIN') || `http://localhost:${Conf.port}`; } /** URL to an external Nostr viewer. */ static get externalDomain() {