galexrt/container-healthchecks

Hint: How to circumvent problems with ":" (Telegram Token)

derphilipp opened this issue · 5 comments

Setting TELEGRAM_TOKEN causes problems as it contains a ":" symbol and is not escaped properly by the entrypoint script.

Workaround:

To properly add a TELEGRAM_TOKEN that contains a : symbol, you can set it in your docker-compose.yml via

- HC_TELEGRAM_TOKEN: '""1234567:ABCDEFH__IJKLMNOPQRSTUVWXYZ""'

This way it gets rewritten into the generated settings.py as

TELEGRAM_TOKEN = """1234567:ABCDEFH__IJKLMNOPQRSTUVWXYZ"""

@derphilipp How is it inserted normally when specifying the token as is without additional quotes? Is it added as a plain string or in qoutes?

If you add it like this:

"HC_TELEGRAM_TOKEN=1234567:ABCDEFH__IJKLMNOPQRSTUVWXYZ"

It works in terms of importing, but in the file it becomes

TELEGRAM_TOKEN = 1234567:ABCDEFH__IJKLMNOPQRSTUVWXYZ

which results in an error, because the string is not inside quotes, etc.
I have played around with single quotes, double quotes, escaped quotes etc - but they have some issues besides the solution given above. Therefore I wanted to share that info 😄

@derphilipp I'll push a fix in a few minutes.

@derphilipp Fix pushed in ea0a474.

Let me know if that fixes the issue for you (image should be built in around 10 minutes or so on Docker Hub).

Closing as a fix has been pushed and I wasn't able to repro it.