fmartinou / whats-up-docker

What's up Docker ( aka WUD ) gets you notified when a new version of your Docker Container is available.
https://fmartinou.github.io/whats-up-docker
MIT License
939 stars 29 forks source link

Telegram and secret file #333

Open nicolas-r opened 7 months ago

nicolas-r commented 7 months ago

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

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

Any idea ?

Thanks

Nicolas

nicolas-r commented 7 months ago

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 commented 7 months ago

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 commented 6 months ago

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