Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram and secret file #333

Open
nicolas-r opened this issue Nov 19, 2023 · 3 comments
Open

Telegram and secret file #333

nicolas-r opened this issue Nov 19, 2023 · 3 comments

Comments

@nicolas-r
Copy link

Hi

I'm trying to put all my secrets into file and not in compose file but I'm facing a strange issue

If I use the following configuration, I can see that WUD is able to read the files properly but when sending the message, I get a 404 error

  • WUD_TRIGGER_TELEGRAM_1_BOTTOKEN__FILE=/secrets/telegram.token
  • WUD_TRIGGER_TELEGRAM_1_CHATID__FILE=/secrets/telegram.chatid

15:17:59.702 INFO whats-up-docker/trigger.telegram.1: Register with configuration {"once":false,"mode":"batch","threshold":"all","bottoken":"1**********************************************\n","chatid":"-*********\n","simpletitle":"New ${kind} found for container ${name}","simplebody":"Container ${name} running with ${kind} ${local} can be updated to ${kind} ${remote}\n${link}","batchtitle":"${count} updates available"}

15:18:05.868 WARN whats-up-docker/trigger.telegram.1: Error (ETELEGRAM: 404 Not Found)

If I put the token directly in the compose file like below, I can receive the message

  • WUD_TRIGGER_TELEGRAM_1_BOTTOKEN=xxxx:yyyyyyy
  • WUD_TRIGGER_TELEGRAM_1_CHATID__FILE=/secrets/telegram.chatid

Any idea ?

Thanks

Nicolas

@nicolas-r
Copy link
Author

Hi

I can see one difference

When the token is inside a file, there is a \n at the end and that doesn't work
16:05:08.893 INFO whats-up-docker/trigger.telegram.1: Register with configuration {"mode":"batch","once":false,"threshold":"all","bottoken":"1***********************************E\n","chatid":"-\n","simpletitle":"New ${kind} found for container ${name}","simplebody":"Container ${name} running with ${kind} ${local} can be updated to ${kind} ${remote}\n${link}","batchtitle":"${count} updates available"}

When the token is inside a variable, there is no \n at the end and that works
16:07:38.317 INFO whats-up-docker/trigger.telegram.1: Register with configuration {"mode":"batch","once":false,"threshold":"all","bottoken":"1***********************************E","chatid":"-\n","simpletitle":"New ${kind} found for container ${name}","simplebody":"Container ${name} running with ${kind} ${local} can be updated to ${kind} ${remote}\n${link}","batchtitle":"${count} updates available"}

Nicolas

@nicolas-r
Copy link
Author

I have added a trim and now that works

this.telegramBot = new TelegramBot(this.configuration.bottoken.trim());

This is a quick and dirty fix, I'm sure there is a better way to fix that

Nicolas

@Marco674
Copy link

Marco674 commented Jan 7, 2024

Hi,
Confimed, would be great to add _FILE variable for registries passwords,
Tried it on Hub registry it does not work for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants