alertmanager
alertmanager copied to clipboard
Add chat_id_file configuration parameter for Telegram
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
ChatIDFilefield toTelegramConfigstruct - Updated validation to require either
chat_idorchat_id_file(but not both) - Added
getChatID()method to read chat_id from file - Updated
Notify()method to use the newgetChatID()method
Testing
- Follows the same pattern as
bot_token_file - Validates that either
chat_idorchat_id_fileis provided - Validates that both are not provided simultaneously
- Reads and parses chat_id from file as int64
Fixes #4672
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
related #2498