irc: Make connection params configurable
This commit is contained in:
parent
2c8bda6151
commit
d067be38b4
1 changed files with 13 additions and 5 deletions
18
ircbot.py
18
ircbot.py
|
@ -140,14 +140,22 @@ def main(*, server, channel, nick, mqtt_host):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mqtt_host = os.getenv("MQTT_HOST")
|
||||
if not mqtt_host:
|
||||
if not (mqtt_host := os.getenv("MQTT_HOST")):
|
||||
print("MQTT_HOST unset")
|
||||
sys.exit(1)
|
||||
if not (irc_server := os.getenv("IRC_SERVER")):
|
||||
print("IRC_SERVER unset")
|
||||
sys.exit(1)
|
||||
if not (irc_channel := os.getenv("IRC_CHANNEL")):
|
||||
print("IRC_CHANNEL unset")
|
||||
sys.exit(1)
|
||||
if not (irc_nick := os.getenv("IRC_NICK")):
|
||||
print("IRC_NICK unset")
|
||||
sys.exit(1)
|
||||
|
||||
main(
|
||||
server="irc.libera.chat",
|
||||
channel="#bitlair-bot-test",
|
||||
nick="Bitlair",
|
||||
server=irc_server,
|
||||
channel=irc_channel,
|
||||
nick=irc_nick,
|
||||
mqtt_host=mqtt_host,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue