-
Notifications
You must be signed in to change notification settings - Fork 69
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
Added sendToTelegram in proxy and notifier #232
base: dev
Are you sure you want to change the base?
Conversation
Nice!! |
Added TG optional feature + TG bot parameters "URL, API Key, conversation ID)in setup.sh. In order to post a message to TG from CN, use the notifier_telegram function. See cyphernode/proxy_docker/app/tests/test-telegram.sh TG doc to configure the bot can be found here : doc/TELEGRAM.md |
This is pretty cool, I rebased locally and tested it. Here are some improvements I thought about, let me know what you think:
Ultimately (another enhancement/project), I think it would be a good idea to put all the CN configurations in the database, except for the ones needed for docker to start the services. And an endpoint to reload the configs without restarting CN. So the operator would have to:
Then the getUpdates would return something:
The What do you think? |
We now have 3 parameters for TG during CN setup: To make things easier, we could use the default value for the telegram_bot_url - not ask the user and add it into the DB config table you mentionned cyphernode_props.
<<BotFather answer: Use this token to access the HTTP API:
Next, the scripts actively waits while curling the TG server to get the telegram_chat_id
The curl is something like https://api.telegram.org/botTELEGRAM_API_KEY/getUpdates. Once everything is working (the message.chat.id is found), saves the chat_id in the DB. The end There doesn't seem to be a way around to avoid going back and forth from the setup to TG, back to setup to paste the API KEY and TG again to send a message. |
Oops #260 is a prerequisite to this! :-D |
@@ -276,11 +276,14 @@ services: | |||
- .env/notifier.env | |||
volumes: | |||
- "<%= logs_datapath %>:/cnlogs" | |||
- "<%= proxy_datapath %>:/proxy/db" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for pgpass? Let's only mount that specific file... and not in /proxy/db but something more relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Will do
For new installations, I added a wait loop to avoid errors in psql log saying Table did not exist - Database was being created |
If you have time to take a look at this PR , I cleaned up to tg setup output to look more like start.sh |
Let me know when u have time to take a look