From 89283fa3da03155fed5c8f8b7df8bd4e47ba0c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Fri, 25 Nov 2022 04:08:01 +0100 Subject: [PATCH] rework PR comments --- backend/src/federation/index.ts | 10 ++-------- backend/src/index.ts | 6 +++++- deployment/bare_metal/.env.dist | 11 ++++++----- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index 352724274..82b961c63 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -10,15 +10,9 @@ function between(min: number, max: number) { return Math.floor(Math.random() * (max - min + 1) + min) } -const getSeed = (): Buffer | null => { - if (CONFIG.FEDERATION_DHT_SEED) { - logger.debug(`with seed='${CONFIG.FEDERATION_DHT_SEED}'`) - return Buffer.alloc(KEY_SECRET_SEEDBYTES, CONFIG.FEDERATION_DHT_SEED) - } - return null -} - const KEY_SECRET_SEEDBYTES = 32 +const getSeed = (): Buffer | null => + CONFIG.FEDERATION_DHT_SEED ? Buffer.alloc(KEY_SECRET_SEEDBYTES, CONFIG.FEDERATION_DHT_SEED) : null const POLLTIME = 20000 const SUCCESSTIME = 120000 diff --git a/backend/src/index.ts b/backend/src/index.ts index 35fb191cd..e63f80827 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -21,7 +21,11 @@ async function main() { // start DHT hyperswarm when DHT_TOPIC is set in .env if (CONFIG.FEDERATION_DHT_TOPIC) { // eslint-disable-next-line no-console - console.log(`Federation active on ${CONFIG.FEDERATION_DHT_TOPIC}`) + console.log( + `starting Federation on ${CONFIG.FEDERATION_DHT_TOPIC} ${ + CONFIG.FEDERATION_DHT_SEED ? 'with seed...' : 'without seed...' + }`, + ) await startDHT(CONFIG.FEDERATION_DHT_TOPIC) // con, } } diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 1d0e96455..5fb81c26a 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -26,7 +26,7 @@ COMMUNITY_REDEEM_CONTRIBUTION_URL=https://stage1.gradido.net/redeem/CL-{code} COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" # backend -BACKEND_CONFIG_VERSION=v11.2022-10-27 +BACKEND_CONFIG_VERSION=v12.2022-11-10 JWT_EXPIRES_IN=10m GDT_API_URL=https://gdt.gradido.net @@ -59,10 +59,11 @@ WEBHOOK_ELOPAGE_SECRET=secret # EventProtocol EVENT_PROTOCOL_DISABLED=false -## DHT -## if you set this value, the DHT hyperswarm will start to announce and listen -## on an hash created from this tpoic -# DHT_TOPIC=GRADIDO_HUB +# Federation +# if you set the value of FEDERATION_DHT_TOPIC, the DHT hyperswarm will start to announce and listen +# on an hash created from this topic +FEDERATION_DHT_TOPIC=GRADIDO_HUB +# FEDERATION_DHT_SEED=64ebcb0e3ad547848fef4197c6e2332f # database DATABASE_CONFIG_VERSION=v1.2022-03-18