Skip to content

Commit

Permalink
Introduce a featureflag to limit sending of notifications to our sandbox
Browse files Browse the repository at this point in the history
Refs: #645
  • Loading branch information
Daniel Haarhoff committed Nov 28, 2024
1 parent 9eaaf24 commit 1486901
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions fly.sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ BULLMQ_WORKER_POLL = "30 seconds"
SLACK_CHANNEL_ID = "C05N0JHBC1Y"
SLACK_SHARE_CHANNEL_ID = "C05V6TXHETS"
REDIS_IP_VERSION = "6"
CAN_NOTIFY_SCIETY = "true"

[http_service]
internal_port = 3000
Expand Down
10 changes: 8 additions & 2 deletions src/Router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpMiddleware, HttpRouter, HttpServerRequest, HttpServerResponse } from '@effect/platform'
import { Schema, TreeFormatter } from '@effect/schema'
import { Array, Context, Data, Effect, Exit, Match, Option } from 'effect'
import { Array, Config, Context, Data, Effect, Exit, Match, Option } from 'effect'
import { StatusCodes } from 'http-status-codes'
import { createHash } from 'node:crypto'
import slackifyMarkdown from 'slackify-markdown'
Expand Down Expand Up @@ -222,6 +222,12 @@ const RequestsSchema = Schema.Array(
}),
)

const notifyScietyCoarInbox = Effect.void
const notifyScietyCoarInbox = Effect.gen(function* () {
const canNotifySciety = yield* Config.withDefault(Config.boolean('CAN_NOTIFY_SCIETY'), false)
if (!canNotifySciety) {
return
}
yield* Effect.logDebug('Should notify Sciety')
})

const md5 = (content: string) => createHash('md5').update(content).digest('hex')

0 comments on commit 1486901

Please sign in to comment.