diff --git a/server/src/config/serverSettings.ts b/server/src/config/serverSettings.ts index cfc39253..b03ba7f7 100644 --- a/server/src/config/serverSettings.ts +++ b/server/src/config/serverSettings.ts @@ -12,6 +12,7 @@ import { getSettingsFile, readSettings, writeSettings } from './settings' export interface ServerSettings { telegramBotToken: string | null + telegramNotification: boolean webappHost: string webappPort: number webappUrl: string @@ -22,6 +23,7 @@ export interface ServerSettingsResult { settings: ServerSettings sources: { telegramBotToken: 'env' | 'file' | 'default' + telegramNotification: 'env' | 'file' | 'default' webappHost: 'env' | 'file' | 'default' webappPort: 'env' | 'file' | 'default' webappUrl: 'env' | 'file' | 'default' @@ -84,6 +86,7 @@ export async function loadServerSettings(dataDir: string): Promise file > true (default enabled for backward compatibility) + let telegramNotification = true + if (process.env.TELEGRAM_NOTIFICATION !== undefined) { + telegramNotification = process.env.TELEGRAM_NOTIFICATION === 'true' + sources.telegramNotification = 'env' + if (settings.telegramNotification === undefined) { + settings.telegramNotification = telegramNotification + needsSave = true + } + } else if (settings.telegramNotification !== undefined) { + telegramNotification = settings.telegramNotification + sources.telegramNotification = 'file' + } + // webappHost: env > file > 127.0.0.1 let webappHost = '127.0.0.1' if (process.env.WEBAPP_HOST) { @@ -174,6 +191,7 @@ export async function loadServerSettings(dataDir: string): Promise