diff --git a/README.md b/README.md index f94e05a..e50c3dc 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,16 @@ smooth-operator shows logs using flask, and stores logs using peewee. Install th ## Usage -smooth-operator requires Python 2. It is NOT compatible with Python 3. The Configuration is done inside logbot.py. +smooth-operator requires Python 2. It is NOT compatible with Python 3. Configuration is either done inside logbot.py, or using environment variables. The following environment variables are respected: + +- ``IRC_SERVER``: IRC server +- ``IRC_PORT``: IRC server port +- ``IRC_SERVER_PASS``: Password for IRC server, if any +- ``IRC_CHANNELS``: IRC channels to join, separated by ``,`` +- ``IRC_NICK``: Nickname +- ``IRC_NICK_PASS``: Password to use when authenticating to nickserv, if any + +The bot can be launched using: python2 logbot.py diff --git a/logbot.py b/logbot.py index cf0177a..0c1fcc5 100755 --- a/logbot.py +++ b/logbot.py @@ -79,12 +79,12 @@ def urlify2(value): DEBUG = False # IRC Server Configuration -SERVER = "irc.freenode.net" -PORT = 6667 -SERVER_PASS = None -CHANNELS=["#pelux"] -NICK = "pelux" -NICK_PASS = "" +SERVER = os.getenv("IRC_SERVER", "irc.freenode.net") +PORT = os.getenv("IRC_PORT", 6667) +SERVER_PASS = os.getenv("IRC_SERVER_PASS", None) +CHANNELS = os.getenv("IRC_CHANNELS", "#pelux").split(",") +NICK = os.getenv("IRC_NICK", "pelux") +NICK_PASS = os.getenv("IRC_NICK_PASS", "") # The local folder to save logs LOG_FOLDER = "/var/www/html/"