Skip to content

Commit 9eb214e

Browse files
authored
Merge pull request #3 from Concordium/version-2
Discord-bot Version 2
2 parents d680704 + e733993 commit 9eb214e

30 files changed

+6965
-1846
lines changed

.env.template

Lines changed: 149 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,177 @@
1-
# Server Configuration
1+
# =============================================================================
2+
# Server Configuration (used by server.js for OAuth redirects, etc.)
3+
# =============================================================================
4+
5+
# Public base URL of your web server (HTTPS strongly recommended).
6+
# Example: https://yourdomain.com
27
SERVER_URL=
8+
9+
# OAuth redirect/callback URL. Must match GitHub App settings.
10+
# Example: https://yourdomain.com/callback
311
REDIRECT_URI=
412

5-
# Github App OAuth Configuration
13+
# =============================================================================
14+
# GitHub App OAuth Configuration
15+
# =============================================================================
16+
17+
# GitHub OAuth App credentials (from GitHub settings).
618
CLIENT_ID=
719
CLIENT_SECRET=
820

9-
# Concordium stuff
21+
# =============================================================================
22+
# Concordium / Node / Explorers
23+
# =============================================================================
24+
25+
# Base URL for block links in notifications (explorer/dash).
26+
# Example (Mainnet CCDScan): https://ccdscan.io/
27+
CCDSCAN_BASE_URL=
28+
29+
# Path to `concordium-client` binary.
30+
# Use absolute path if not in $PATH. Example: /usr/local/bin/concordium-client
31+
# Default if empty: "concordium-client"
1032
CONCORDIUM_CLIENT_PATH=
33+
34+
# gRPC node connection (host + port + TLS).
35+
# Examples:
36+
# GRPC_IP=grpc.mainnet.concordium.software
37+
# GRPC_PORT=20000
38+
# GRPC_TLS=1 (enable TLS) | 0 (disable)
1139
GRPC_IP=
40+
GRPC_PORT=
41+
GRPC_TLS=
1242

43+
# =============================================================================
1344
# Discord Bot Configuration
45+
# =============================================================================
46+
47+
# Bot token from Discord Developer Portal.
1448
DISCORD_BOT_TOKEN=
49+
50+
# Guild (server) ID where commands and roles are managed.
1551
DISCORD_GUILD_ID=
1652

17-
# Discord Roles
53+
# =============================================================================
54+
# Discord Roles (IDs)
55+
# =============================================================================
56+
57+
# Internal "team" role allowed to run !setup, etc.
1858
TEAM_ROLE_ID=
59+
60+
# Target roles assigned after successful verifications.
1961
VALIDATOR_ROLE_ID=
2062
DEV_ROLE_ID=
2163
DELEGATOR_ROLE_ID=
2264

23-
# Discord Channels
65+
# =============================================================================
66+
# Discord Channels (IDs)
67+
# =============================================================================
68+
69+
# Channel where users claim roles / see the select menu (posted by !setup).
2470
CLAIM_CHANNEL_ID=
2571

26-
# Discord AutoModeration rule ID
72+
# Private validator lounge channel (granted after validator verification).
73+
VALIDATOR_CHANNEL_ID=
74+
75+
# Moderation / audit log channel for bot actions.
76+
MOD_LOGS_CHANNEL_ID=
77+
78+
# =============================================================================
79+
# Discord AutoModeration (optional)
80+
# =============================================================================
81+
82+
# AutoMod rule ID the bot integrates with (to allow links in private tickets, etc.).
2783
AUTOMOD_RULE_ID=
2884

85+
# =============================================================================
2986
# PostgreSQL Database Configuration
87+
# =============================================================================
88+
# Standard Postgres settings. PG_PORT default: 5432
3089
PG_USER=
3190
PG_HOST=
3291
PG_DATABASE=
3392
PG_PASSWORD=
3493
PG_PORT=
94+
95+
# =============================================================================
96+
# Internal HTTP (bot -> server.js inside container/network)
97+
# =============================================================================
98+
99+
# Base URL for internal HTTP calls from the bot to server.js.
100+
# Example (same container/network): http://127.0.0.1:3000
101+
INTERNAL_HTTP_BASE=
102+
103+
# =============================================================================
104+
# gRPC / tx-logger verbosity & filters (txloggerListener.js)
105+
# =============================================================================
106+
107+
# TXL_DEBUG: extra debug logs from the gRPC listener and memo waiters.
108+
# Allowed: 0/1 or false/true (case-insensitive). Default: 0
109+
# 1 (true) -> verbose internal logs (sender, memo matches, waiter TTL)
110+
# 0 (false) -> quieter
111+
TXL_DEBUG=
112+
113+
# TXL_LOG_BLOCKS: per-block log lines when new finalized blocks are processed.
114+
# Allowed: 0/1 or false/true. Default: 0
115+
TXL_LOG_BLOCKS=
116+
117+
# TXL_LOG_SPECIAL: log "special events" stream (e.g., PayDayAccountReward, suspension pending).
118+
# Allowed: 0/1 or false/true. Default: 0
119+
TXL_LOG_SPECIAL=
120+
121+
# TXL_SPECIAL_TAGS: optional allow-list of special-event tags (CSV).
122+
# If set, only tags in this list are logged. Example: PaydayAccountReward,ValidatorSuspended
123+
TXL_SPECIAL_TAGS=
124+
125+
# TXL_LOG_TX_EVENTS: log transaction events (DelegationAdded, DelegationRemoved, etc.).
126+
# Allowed: 0/1 or false/true. Default: 0
127+
TXL_LOG_TX_EVENTS=
128+
129+
# TXL_EVENT_TAGS: optional allow-list of tx event tags (CSV).
130+
# If set AND TXL_LOG_TX_EVENTS=1, only these tags are logged. Example: DelegationAdded,DelegationSetDelegationTarget
131+
TXL_EVENT_TAGS=
132+
133+
# (Optional) ALERTS_DEBUG: extra logs from alerts.js (DM fan-out, commission updates, etc.)
134+
# Allowed: 0/1 or false/true. Default: 0
135+
ALERTS_DEBUG=
136+
137+
# =============================================================================
138+
# Transaction waiters & thread cleanup (tuning)
139+
# =============================================================================
140+
141+
# TXL_WAITER_TTL_MINUTES: how long we wait for a transaction memo from a specific sender (minutes).
142+
# Default: 20
143+
TXL_WAITER_TTL_MINUTES=
144+
145+
# TXL_PRUNE_INTERVAL_MS: how often to prune expired memo waiters (milliseconds).
146+
# Default: 60000 (1 minute)
147+
TXL_PRUNE_INTERVAL_MS=
148+
149+
# THREAD_CLEANUP_INTERVAL_MS: how often to check and auto-close inactive verification threads (milliseconds).
150+
# THREAD_INACTIVITY_LIMIT_MS: inactivity threshold (milliseconds).
151+
THREAD_CLEANUP_INTERVAL_MS=
152+
THREAD_INACTIVITY_LIMIT_MS=
153+
154+
# =============================================================================
155+
# CSV Import & Post-Import Enrichment (backfill)
156+
# =============================================================================
157+
158+
# IMPORT_VERIFICATIONS_CSV: path to v1 CSV to import at startup (inside container).
159+
# Example: /seed/verifications_v1.csv
160+
IMPORT_VERIFICATIONS_CSV=
161+
162+
# IMPORT_RUN_ON_EMPTY:
163+
# 1 (true) -> import ONLY if the 'verifications' table is empty (safe default for production)
164+
# 0 (false) -> always run import (rows with existing IDs are skipped due to ON CONFLICT DO NOTHING)
165+
# Default: 1
166+
IMPORT_RUN_ON_EMPTY=
167+
168+
# IMPORT_POST_ENRICH:
169+
# 1 (true) -> after import, enrich data: fill validator_id/is_suspended, fetch commissions,
170+
# sync validator_delegators, and set delegation_target for delegators.
171+
# 0 (false) -> skip enrichment step.
172+
# Default: 1
173+
IMPORT_POST_ENRICH=
174+
175+
# BACKFILL_DEBUG: verbose logs for the importer/enricher.
176+
# Allowed: 0/1 or false/true. Default: 0
177+
BACKFILL_DEBUG=

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ npm-debug.log
44

55
# Environment files
66
.env
7+
.env.template
8+
9+
# database from discord bot V1
10+
/seed/verifications_v1.csv
711

812
# OS / Editor junk
913
.DS_Store

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
ARG build_image="node:20"
33
FROM ${build_image}
44

5-
# Install system dependencies
6-
RUN apt-get update && apt-get install -y curl
5+
# Install system dependencies (curl + CA certs for TLS) and clean apt cache
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends ca-certificates curl && \
8+
rm -rf /var/lib/apt/lists/*
79

8-
# Install concordium-client CLI
9-
RUN curl -L https://distribution.concordium.software/tools/linux/concordium-client_8.0.0-5 \
10+
# Install concordium-client CLI (needs CA certs for HTTPS)
11+
RUN curl -L https://github.com/Concordium/concordium-client/releases/download/9.1.4-0-rc/concordium-client-linux \
1012
-o /usr/bin/concordium-client && \
1113
chmod +x /usr/bin/concordium-client
1214

0 commit comments

Comments
 (0)