From 214fbe0a5c73cdec97d75d4e1d271cd42155fda9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 2 Feb 2023 03:55:01 +0100 Subject: [PATCH 01/10] remove unused constructor --- backend/src/event/Event.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/backend/src/event/Event.ts b/backend/src/event/Event.ts index 09a31d4e0..6a1233224 100644 --- a/backend/src/event/Event.ts +++ b/backend/src/event/Event.ts @@ -1,4 +1,3 @@ -import { EventProtocol } from '@entity/EventProtocol' import decimal from 'decimal.js-light' import { EventProtocolType } from './EventProtocolType' @@ -87,21 +86,6 @@ export class EventDeleteContributionLink extends EventBasicCt {} export class EventUpdateContributionLink extends EventBasicCt {} export class Event { - constructor() - constructor(event?: EventProtocol) { - if (event) { - this.id = event.id - this.type = event.type - this.createdAt = event.createdAt - this.userId = event.userId - this.xUserId = event.xUserId - this.xCommunityId = event.xCommunityId - this.transactionId = event.transactionId - this.contributionId = event.contributionId - this.amount = event.amount - } - } - public setEventBasic(): Event { this.type = EventProtocolType.BASIC this.createdAt = new Date() From 2c7e36d7e223b526dba0dd940c6737673d07315b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 2 Feb 2023 03:55:26 +0100 Subject: [PATCH 02/10] fix nullable fields in database entity --- .../EventProtocol.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts b/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts index d4dbc526f..a61895502 100644 --- a/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts +++ b/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts @@ -17,16 +17,16 @@ export class EventProtocol extends BaseEntity { userId: number @Column({ name: 'x_user_id', unsigned: true, nullable: true }) - xUserId: number + xUserId: number | null @Column({ name: 'x_community_id', unsigned: true, nullable: true }) - xCommunityId: number + xCommunityId: number | null @Column({ name: 'transaction_id', unsigned: true, nullable: true }) - transactionId: number + transactionId: number | null @Column({ name: 'contribution_id', unsigned: true, nullable: true }) - contributionId: number + contributionId: number | null @Column({ type: 'decimal', @@ -35,8 +35,8 @@ export class EventProtocol extends BaseEntity { nullable: true, transformer: DecimalTransformer, }) - amount: Decimal + amount: Decimal | null @Column({ name: 'message_id', unsigned: true, nullable: true }) - messageId: number + messageId: number | null } From ab2535abea04e9126c296848d2351ceeaf653a4b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 2 Feb 2023 03:55:47 +0100 Subject: [PATCH 03/10] simplify writeEvent --- backend/src/event/EventProtocolEmitter.ts | 48 ++++++------------- .../graphql/resolver/ContributionResolver.ts | 22 ++++----- .../graphql/resolver/TransactionResolver.ts | 8 ++-- backend/src/graphql/resolver/UserResolver.ts | 20 ++++---- 4 files changed, 34 insertions(+), 64 deletions(-) diff --git a/backend/src/event/EventProtocolEmitter.ts b/backend/src/event/EventProtocolEmitter.ts index b4b22bce1..e22e6218b 100644 --- a/backend/src/event/EventProtocolEmitter.ts +++ b/backend/src/event/EventProtocolEmitter.ts @@ -3,39 +3,21 @@ import { backendLogger as logger } from '@/server/logger' import { EventProtocol } from '@entity/EventProtocol' import CONFIG from '@/config' -class EventProtocolEmitter { - /* }extends EventEmitter { */ - private events: Event[] - - /* - public addEvent(event: Event) { - this.events.push(event) +export const writeEvent = async (event: Event): Promise => { + if (CONFIG.EVENT_PROTOCOL_DISABLED) { + logger.info('EventProtocol is disabled', CONFIG.EVENT_PROTOCOL_DISABLED) + return null } - public getEvents(): Event[] { - return this.events - } - */ - - public isDisabled() { - logger.info(`EventProtocol - isDisabled=${CONFIG.EVENT_PROTOCOL_DISABLED}`) - return CONFIG.EVENT_PROTOCOL_DISABLED === true - } - - public async writeEvent(event: Event): Promise { - if (!eventProtocol.isDisabled()) { - logger.info(`writeEvent(${JSON.stringify(event)})`) - const dbEvent = new EventProtocol() - dbEvent.type = event.type - dbEvent.createdAt = event.createdAt - dbEvent.userId = event.userId - if (event.xUserId) dbEvent.xUserId = event.xUserId - if (event.xCommunityId) dbEvent.xCommunityId = event.xCommunityId - if (event.contributionId) dbEvent.contributionId = event.contributionId - if (event.transactionId) dbEvent.transactionId = event.transactionId - if (event.amount) dbEvent.amount = event.amount - await dbEvent.save() - } - } + logger.info(`writeEvent(${JSON.stringify(event)})`) + const dbEvent = new EventProtocol() + dbEvent.type = event.type + dbEvent.createdAt = event.createdAt + dbEvent.userId = event.userId + dbEvent.xUserId = event.xUserId || null + dbEvent.xCommunityId = event.xCommunityId || null + dbEvent.contributionId = event.contributionId || null + dbEvent.transactionId = event.transactionId || null + dbEvent.amount = event.amount || null + return dbEvent.save() } -export const eventProtocol = new EventProtocolEmitter() diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 0c758b52b..b5357709c 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -46,7 +46,7 @@ import { EventAdminContributionDelete, EventAdminContributionUpdate, } from '@/event/Event' -import { eventProtocol } from '@/event/EventProtocolEmitter' +import { writeEvent } from '@/event/EventProtocolEmitter' import { calculateDecay } from '@/util/decay' import { sendContributionConfirmedEmail, @@ -97,7 +97,7 @@ export class ContributionResolver { eventCreateContribution.userId = user.id eventCreateContribution.amount = amount eventCreateContribution.contributionId = contribution.id - await eventProtocol.writeEvent(event.setEventContributionCreate(eventCreateContribution)) + await writeEvent(event.setEventContributionCreate(eventCreateContribution)) return new UnconfirmedContribution(contribution, user, creations) } @@ -133,7 +133,7 @@ export class ContributionResolver { eventDeleteContribution.userId = user.id eventDeleteContribution.contributionId = contribution.id eventDeleteContribution.amount = contribution.amount - await eventProtocol.writeEvent(event.setEventContributionDelete(eventDeleteContribution)) + await writeEvent(event.setEventContributionDelete(eventDeleteContribution)) const res = await contribution.softRemove() return !!res @@ -279,7 +279,7 @@ export class ContributionResolver { eventUpdateContribution.userId = user.id eventUpdateContribution.contributionId = contributionId eventUpdateContribution.amount = amount - await eventProtocol.writeEvent(event.setEventContributionUpdate(eventUpdateContribution)) + await writeEvent(event.setEventContributionUpdate(eventUpdateContribution)) return new UnconfirmedContribution(contributionToUpdate, user, creations) } @@ -346,9 +346,7 @@ export class ContributionResolver { eventAdminCreateContribution.userId = moderator.id eventAdminCreateContribution.amount = amount eventAdminCreateContribution.contributionId = contribution.id - await eventProtocol.writeEvent( - event.setEventAdminContributionCreate(eventAdminCreateContribution), - ) + await writeEvent(event.setEventAdminContributionCreate(eventAdminCreateContribution)) return getUserCreation(emailContact.userId, clientTimezoneOffset) } @@ -458,9 +456,7 @@ export class ContributionResolver { eventAdminContributionUpdate.userId = user.id eventAdminContributionUpdate.amount = amount eventAdminContributionUpdate.contributionId = contributionToUpdate.id - await eventProtocol.writeEvent( - event.setEventAdminContributionUpdate(eventAdminContributionUpdate), - ) + await writeEvent(event.setEventAdminContributionUpdate(eventAdminContributionUpdate)) return result } @@ -538,9 +534,7 @@ export class ContributionResolver { eventAdminContributionDelete.userId = contribution.userId eventAdminContributionDelete.amount = contribution.amount eventAdminContributionDelete.contributionId = contribution.id - await eventProtocol.writeEvent( - event.setEventAdminContributionDelete(eventAdminContributionDelete), - ) + await writeEvent(event.setEventAdminContributionDelete(eventAdminContributionDelete)) sendContributionDeniedEmail({ firstName: user.firstName, lastName: user.lastName, @@ -668,7 +662,7 @@ export class ContributionResolver { eventContributionConfirm.userId = user.id eventContributionConfirm.amount = contribution.amount eventContributionConfirm.contributionId = contribution.id - await eventProtocol.writeEvent(event.setEventContributionConfirm(eventContributionConfirm)) + await writeEvent(event.setEventContributionConfirm(eventContributionConfirm)) } finally { releaseLock() } diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 2f97596b2..b75782abf 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -30,7 +30,7 @@ import { sendTransactionReceivedEmail, } from '@/emails/sendEmailVariants' import { Event, EventTransactionReceive, EventTransactionSend } from '@/event/Event' -import { eventProtocol } from '@/event/EventProtocolEmitter' +import { writeEvent } from '@/event/EventProtocolEmitter' import { BalanceResolver } from './BalanceResolver' import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' @@ -144,16 +144,14 @@ export const executeTransaction = async ( eventTransactionSend.xUserId = transactionSend.linkedUserId eventTransactionSend.transactionId = transactionSend.id eventTransactionSend.amount = transactionSend.amount.mul(-1) - await eventProtocol.writeEvent(new Event().setEventTransactionSend(eventTransactionSend)) + await writeEvent(new Event().setEventTransactionSend(eventTransactionSend)) const eventTransactionReceive = new EventTransactionReceive() eventTransactionReceive.userId = transactionReceive.userId eventTransactionReceive.xUserId = transactionReceive.linkedUserId eventTransactionReceive.transactionId = transactionReceive.id eventTransactionReceive.amount = transactionReceive.amount - await eventProtocol.writeEvent( - new Event().setEventTransactionReceive(eventTransactionReceive), - ) + await writeEvent(new Event().setEventTransactionReceive(eventTransactionReceive)) } catch (e) { await queryRunner.rollbackTransaction() logger.error(`Transaction was not successful: ${e}`) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 94b9265b3..aa56e81bc 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -48,7 +48,7 @@ import { klicktippNewsletterStateMiddleware } from '@/middleware/klicktippMiddle import { klicktippSignIn } from '@/apis/KlicktippController' import { RIGHTS } from '@/auth/RIGHTS' import { hasElopageBuys } from '@/util/hasElopageBuys' -import { eventProtocol } from '@/event/EventProtocolEmitter' +import { writeEvent } from '@/event/EventProtocolEmitter' import { Event, EventLogin, @@ -181,7 +181,7 @@ export class UserResolver { }) const ev = new EventLogin() ev.userId = user.id - eventProtocol.writeEvent(new Event().setEventLogin(ev)) + writeEvent(new Event().setEventLogin(ev)) logger.info(`successful Login: ${JSON.stringify(user, null, 2)}`) return user } @@ -253,9 +253,7 @@ export class UserResolver { }) const eventSendAccountMultiRegistrationEmail = new EventSendAccountMultiRegistrationEmail() eventSendAccountMultiRegistrationEmail.userId = foundUser.id - eventProtocol.writeEvent( - event.setEventSendConfirmationEmail(eventSendAccountMultiRegistrationEmail), - ) + writeEvent(event.setEventSendConfirmationEmail(eventSendAccountMultiRegistrationEmail)) logger.info( `sendAccountMultiRegistrationEmail by ${firstName} ${lastName} to ${foundUser.firstName} ${foundUser.lastName} <${email}>`, ) @@ -349,7 +347,7 @@ export class UserResolver { }) logger.info(`sendAccountActivationEmail of ${firstName}.${lastName} to ${email}`) eventSendConfirmEmail.userId = dbUser.id - eventProtocol.writeEvent(event.setEventSendConfirmationEmail(eventSendConfirmEmail)) + writeEvent(event.setEventSendConfirmationEmail(eventSendConfirmEmail)) if (!emailSent) { logger.debug(`Account confirmation link: ${activationLink}`) @@ -368,10 +366,10 @@ export class UserResolver { if (redeemCode) { eventRedeemRegister.userId = dbUser.id - await eventProtocol.writeEvent(event.setEventRedeemRegister(eventRedeemRegister)) + await writeEvent(event.setEventRedeemRegister(eventRedeemRegister)) } else { eventRegister.userId = dbUser.id - await eventProtocol.writeEvent(event.setEventRegister(eventRegister)) + await writeEvent(event.setEventRegister(eventRegister)) } return new User(dbUser) @@ -507,7 +505,7 @@ export class UserResolver { const eventActivateAccount = new EventActivateAccount() eventActivateAccount.userId = user.id - eventProtocol.writeEvent(event.setEventActivateAccount(eventActivateAccount)) + writeEvent(event.setEventActivateAccount(eventActivateAccount)) } catch (e) { await queryRunner.rollbackTransaction() logger.error('Error on writing User and UserContact data:' + e) @@ -874,9 +872,7 @@ export class UserResolver { const event = new Event() const eventSendConfirmationEmail = new EventSendConfirmationEmail() eventSendConfirmationEmail.userId = user.id - await eventProtocol.writeEvent( - event.setEventSendConfirmationEmail(eventSendConfirmationEmail), - ) + await writeEvent(event.setEventSendConfirmationEmail(eventSendConfirmationEmail)) } return true From f577e3258a1957e7312d16a8bdd5a60f97dc22d6 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 2 Feb 2023 04:04:05 +0100 Subject: [PATCH 04/10] also make older entity models nullable --- .../0043-add_event_protocol_table/EventProtocol.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/database/entity/0043-add_event_protocol_table/EventProtocol.ts b/database/entity/0043-add_event_protocol_table/EventProtocol.ts index 72470d2ed..c05651df2 100644 --- a/database/entity/0043-add_event_protocol_table/EventProtocol.ts +++ b/database/entity/0043-add_event_protocol_table/EventProtocol.ts @@ -14,19 +14,19 @@ export class EventProtocol extends BaseEntity { createdAt: Date @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number + userId: number | null @Column({ name: 'x_user_id', unsigned: true, nullable: true }) - xUserId: number + xUserId: number | null @Column({ name: 'x_community_id', unsigned: true, nullable: true }) - xCommunityId: number + xCommunityId: number | null @Column({ name: 'transaction_id', unsigned: true, nullable: true }) - transactionId: number + transactionId: number | null @Column({ name: 'contribution_id', unsigned: true, nullable: true }) - contributionId: number + contributionId: number | null @Column({ type: 'decimal', @@ -35,5 +35,5 @@ export class EventProtocol extends BaseEntity { nullable: true, transformer: DecimalTransformer, }) - amount: Decimal + amount: Decimal | null } From 357588a6808a1d2309046d3906186e2683191998 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 2 Feb 2023 04:08:07 +0100 Subject: [PATCH 05/10] define type properly --- .../0043-add_event_protocol_table/EventProtocol.ts | 12 ++++++------ .../EventProtocol.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/database/entity/0043-add_event_protocol_table/EventProtocol.ts b/database/entity/0043-add_event_protocol_table/EventProtocol.ts index c05651df2..72470d2ed 100644 --- a/database/entity/0043-add_event_protocol_table/EventProtocol.ts +++ b/database/entity/0043-add_event_protocol_table/EventProtocol.ts @@ -14,19 +14,19 @@ export class EventProtocol extends BaseEntity { createdAt: Date @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number | null + userId: number @Column({ name: 'x_user_id', unsigned: true, nullable: true }) - xUserId: number | null + xUserId: number @Column({ name: 'x_community_id', unsigned: true, nullable: true }) - xCommunityId: number | null + xCommunityId: number @Column({ name: 'transaction_id', unsigned: true, nullable: true }) - transactionId: number | null + transactionId: number @Column({ name: 'contribution_id', unsigned: true, nullable: true }) - contributionId: number | null + contributionId: number @Column({ type: 'decimal', @@ -35,5 +35,5 @@ export class EventProtocol extends BaseEntity { nullable: true, transformer: DecimalTransformer, }) - amount: Decimal | null + amount: Decimal } diff --git a/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts b/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts index a61895502..e457cc0a3 100644 --- a/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts +++ b/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts @@ -16,16 +16,16 @@ export class EventProtocol extends BaseEntity { @Column({ name: 'user_id', unsigned: true, nullable: false }) userId: number - @Column({ name: 'x_user_id', unsigned: true, nullable: true }) + @Column({ name: 'x_user_id', type: 'int', unsigned: true, nullable: true }) xUserId: number | null - @Column({ name: 'x_community_id', unsigned: true, nullable: true }) + @Column({ name: 'x_community_id', type: 'int', unsigned: true, nullable: true }) xCommunityId: number | null - @Column({ name: 'transaction_id', unsigned: true, nullable: true }) + @Column({ name: 'transaction_id', type: 'int', unsigned: true, nullable: true }) transactionId: number | null - @Column({ name: 'contribution_id', unsigned: true, nullable: true }) + @Column({ name: 'contribution_id', type: 'int', unsigned: true, nullable: true }) contributionId: number | null @Column({ @@ -37,6 +37,6 @@ export class EventProtocol extends BaseEntity { }) amount: Decimal | null - @Column({ name: 'message_id', unsigned: true, nullable: true }) + @Column({ name: 'message_id', type: 'int', unsigned: true, nullable: true }) messageId: number | null } From 7288bfc7dc8e9c1fa6bee0d8549f70e3683991e4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 2 Feb 2023 04:20:36 +0100 Subject: [PATCH 06/10] properly use logger --- backend/src/event/EventProtocolEmitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/event/EventProtocolEmitter.ts b/backend/src/event/EventProtocolEmitter.ts index e22e6218b..9cde4939f 100644 --- a/backend/src/event/EventProtocolEmitter.ts +++ b/backend/src/event/EventProtocolEmitter.ts @@ -9,7 +9,7 @@ export const writeEvent = async (event: Event): Promise => return null } - logger.info(`writeEvent(${JSON.stringify(event)})`) + logger.info('writeEvent', event) const dbEvent = new EventProtocol() dbEvent.type = event.type dbEvent.createdAt = event.createdAt From 5a78228af31269de4b6a9818cbf699689d6b427f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Feb 2023 00:16:53 +0100 Subject: [PATCH 07/10] remove EVENT_PROTOCOL_DISABLED from backend & bare_metal deployment --- backend/.env.dist | 3 --- backend/.env.template | 3 --- backend/src/config/index.ts | 7 +------ backend/src/event/EventProtocolEmitter.ts | 6 ------ deployment/bare_metal/.env.dist | 5 +---- 5 files changed, 2 insertions(+), 22 deletions(-) diff --git a/backend/.env.dist b/backend/.env.dist index ba5b89fa9..3e54b0566 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -55,9 +55,6 @@ EMAIL_CODE_REQUEST_TIME=10 # Webhook WEBHOOK_ELOPAGE_SECRET=secret -# EventProtocol -EVENT_PROTOCOL_DISABLED=false - # SET LOG LEVEL AS NEEDED IN YOUR .ENV # POSSIBLE VALUES: all | trace | debug | info | warn | error | fatal # LOG_LEVEL=info diff --git a/backend/.env.template b/backend/.env.template index f73b87353..e75798325 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -54,9 +54,6 @@ EMAIL_CODE_REQUEST_TIME=$EMAIL_CODE_REQUEST_TIME # Webhook WEBHOOK_ELOPAGE_SECRET=$WEBHOOK_ELOPAGE_SECRET -# EventProtocol -EVENT_PROTOCOL_DISABLED=$EVENT_PROTOCOL_DISABLED - # Federation FEDERATION_DHT_TOPIC=$FEDERATION_DHT_TOPIC FEDERATION_DHT_SEED=$FEDERATION_DHT_SEED diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index d010b4ab0..63ea9c5b6 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -17,7 +17,7 @@ const constants = { LOG_LEVEL: process.env.LOG_LEVEL || 'info', CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v14.2022-12-22', + EXPECTED: 'v15.2023-02-07', CURRENT: '', }, } @@ -99,11 +99,6 @@ const webhook = { WEBHOOK_ELOPAGE_SECRET: process.env.WEBHOOK_ELOPAGE_SECRET || 'secret', } -const eventProtocol = { - // global switch to enable writing of EventProtocol-Entries - EVENT_PROTOCOL_DISABLED: process.env.EVENT_PROTOCOL_DISABLED === 'true' || false, -} - // This is needed by graphql-directive-auth process.env.APP_SECRET = server.JWT_SECRET diff --git a/backend/src/event/EventProtocolEmitter.ts b/backend/src/event/EventProtocolEmitter.ts index 9cde4939f..a87e8a256 100644 --- a/backend/src/event/EventProtocolEmitter.ts +++ b/backend/src/event/EventProtocolEmitter.ts @@ -1,14 +1,8 @@ import { Event } from '@/event/Event' import { backendLogger as logger } from '@/server/logger' import { EventProtocol } from '@entity/EventProtocol' -import CONFIG from '@/config' export const writeEvent = async (event: Event): Promise => { - if (CONFIG.EVENT_PROTOCOL_DISABLED) { - logger.info('EventProtocol is disabled', CONFIG.EVENT_PROTOCOL_DISABLED) - return null - } - logger.info('writeEvent', event) const dbEvent = new EventProtocol() dbEvent.type = event.type diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index e816c9236..9c9c7ac82 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -27,7 +27,7 @@ COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" COMMUNITY_SUPPORT_MAIL=support@supportmail.com # backend -BACKEND_CONFIG_VERSION=v14.2022-12-22 +BACKEND_CONFIG_VERSION=v15.2023-02-07 JWT_EXPIRES_IN=10m GDT_API_URL=https://gdt.gradido.net @@ -56,9 +56,6 @@ EMAIL_CODE_REQUEST_TIME=10 WEBHOOK_ELOPAGE_SECRET=secret -# EventProtocol -EVENT_PROTOCOL_DISABLED=false - # 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 From 24ca1563b898c338b4870cc50489d7ed753c5f20 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Feb 2023 00:17:37 +0100 Subject: [PATCH 08/10] remove EVENT_PROTOCOL_DISABLED from dht-node --- dht-node/.env.dist | 3 --- dht-node/.env.template | 3 --- dht-node/src/config/index.ts | 7 +------ 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/dht-node/.env.dist b/dht-node/.env.dist index c1641ea98..09e25ccb6 100644 --- a/dht-node/.env.dist +++ b/dht-node/.env.dist @@ -8,9 +8,6 @@ DB_PASSWORD= DB_DATABASE=gradido_community TYPEORM_LOGGING_RELATIVE_PATH=typeorm.dht-node.log -# EventProtocol -EVENT_PROTOCOL_DISABLED=false - # SET LOG LEVEL AS NEEDED IN YOUR .ENV # POSSIBLE VALUES: all | trace | debug | info | warn | error | fatal # LOG_LEVEL=info diff --git a/dht-node/.env.template b/dht-node/.env.template index eca7cb277..b31667fdb 100644 --- a/dht-node/.env.template +++ b/dht-node/.env.template @@ -8,9 +8,6 @@ DB_PASSWORD=$DB_PASSWORD DB_DATABASE=gradido_community TYPEORM_LOGGING_RELATIVE_PATH=$TYPEORM_LOGGING_RELATIVE_PATH -# EventProtocol -EVENT_PROTOCOL_DISABLED=$EVENT_PROTOCOL_DISABLED - # Federation FEDERATION_DHT_TOPIC=$FEDERATION_DHT_TOPIC FEDERATION_DHT_SEED=$FEDERATION_DHT_SEED diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 02cbb20e9..cb6fe7c77 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -9,7 +9,7 @@ const constants = { LOG_LEVEL: process.env.LOG_LEVEL || 'info', CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v1.2023-01-01', + EXPECTED: 'v2.2023-02-07', CURRENT: '', }, } @@ -28,11 +28,6 @@ const database = { process.env.TYPEORM_LOGGING_RELATIVE_PATH || 'typeorm.dht-node.log', } -const eventProtocol = { - // global switch to enable writing of EventProtocol-Entries - EVENT_PROTOCOL_DISABLED: process.env.EVENT_PROTOCOL_DISABLED === 'true' || false, -} - const federation = { FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || 'GRADIDO_HUB', FEDERATION_DHT_SEED: process.env.FEDERATION_DHT_SEED || null, From 4d3ea26365ef873292207b4b10166abc969af850 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Feb 2023 00:17:49 +0100 Subject: [PATCH 09/10] remove comment on federation --- federation/src/config/index.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index c2d81d2c8..588f52c60 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -52,10 +52,6 @@ const community = { process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.', } */ -// const eventProtocol = { -// global switch to enable writing of EventProtocol-Entries -// EVENT_PROTOCOL_DISABLED: process.env.EVENT_PROTOCOL_DISABLED === 'true' || false, -// } // This is needed by graphql-directive-auth // process.env.APP_SECRET = server.JWT_SECRET From 151f381d9405a03f4bdb196ccff61621f99404ee Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Feb 2023 00:29:07 +0100 Subject: [PATCH 10/10] fix config aggregation on dht-node & backend --- backend/src/config/index.ts | 1 - dht-node/src/config/index.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 63ea9c5b6..4cca9e0e2 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -134,7 +134,6 @@ const CONFIG = { ...email, ...loginServer, ...webhook, - ...eventProtocol, ...federation, } diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index cb6fe7c77..795925ee3 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -50,7 +50,6 @@ const CONFIG = { ...constants, ...server, ...database, - ...eventProtocol, ...federation, }