Add environment variables for config

This commit is contained in:
Jonatan Pålsson 2017-06-10 10:53:12 +02:00
parent 0a6a0c4e6f
commit 6292af08e6
2 changed files with 16 additions and 7 deletions

View file

@ -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

View file

@ -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/"