-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Had problems connecting to Slack API.
Did the following changes:
Icinga-bot.ini:
Added entry for proxy under [slack]
proxy_url = <PROXY SERVER>:<PORT>
i2_slack_modules/common.py:
Added parser under 'read common section'
config_dict["slack.proxy_url"] = config_handler.get(this_section, "proxy_url", fallback="")
Icinga-bot.py:
Added proxy to connection methods:
client = slack.WebClient(token=config["slack.bot_token"], ssl=slack_ssl_context, proxy=config["slack.proxy_url"], run_async=True)
and
rtm_client = slack.RTMClient( token=config["slack.bot_token"], ssl=slack_ssl_context, run_async=True, loop=loop, proxy="http://" + config["slack.proxy_url"] )
The last will probably fail splendidly if no proxy is defined :) But since the rim_client demanded 'http://' ...
Probably better ways to do this, but it works.
Thanks for making this bot!
R.