alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Add chat_id_file configuration parameter for Telegram

Open tennisleng opened this issue 1 month ago • 2 comments

This PR adds support for reading chat_id from a file, similar to bot_token_file. This allows users to securely pass chat_id using secrets or volumes in docker-compose without exposing it in cleartext in the config file.

Changes

  • Added ChatIDFile field to TelegramConfig struct
  • Updated validation to require either chat_id or chat_id_file (but not both)
  • Added getChatID() method to read chat_id from file
  • Updated Notify() method to use the new getChatID() method

Testing

  • Follows the same pattern as bot_token_file
  • Validates that either chat_id or chat_id_file is provided
  • Validates that both are not provided simultaneously
  • Reads and parses chat_id from file as int64

Fixes #4672

tennisleng avatar Nov 09 '25 20:11 tennisleng

If chat_id is considered a secret it also get mapped to a secret type. Right now it is mapeed to int and is visible unmasked in /#/status

TheMeier avatar Nov 12 '25 14:11 TheMeier

related #2498

TheMeier avatar Nov 12 '25 14:11 TheMeier