diff --git a/.gitignore b/.gitignore index 9631938..56c0b91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -/fishroom/config.py +/fishroom/config/config.json /test/config.py -config.py.production diff --git a/fishroom/config.py b/fishroom/config.py new file mode 100644 index 0000000..6b1b19c --- /dev/null +++ b/fishroom/config.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import json + +config_path = os.path.join( + os.path.dirname(__file__), + "config", + "config.json" +) + +with open(config_path, "r") as f: + config = json.load(f) + +# vim: ts=4 sw=4 sts=4 expandtab diff --git a/fishroom/config.py.example b/fishroom/config/README.md similarity index 93% rename from fishroom/config.py.example rename to fishroom/config/README.md index f65f622..2563afa 100644 --- a/fishroom/config.py.example +++ b/fishroom/config/README.md @@ -1,3 +1,11 @@ +# Fishroom Configuration + +This directory contains the Fishroom configuration file `config.json`. + +You may reference `config.json.example` for details. The JSON file will be +parsed into the following Python dictionary: + +```Python config = { "debug": True, "timezone": "Asia/Shanghai", @@ -119,5 +127,4 @@ config = { } } } - -# vim: ft=python +``` diff --git a/fishroom/config/config.json.example b/fishroom/config/config.json.example new file mode 100644 index 0000000..d3e08eb --- /dev/null +++ b/fishroom/config/config.json.example @@ -0,0 +1,88 @@ +{ + "debug": true, + "timezone": "Asia/Shanghai", + "baseurl": "http://fishroom.example.com", + "name": "teleboto", + "cmd_me": "tg_bot", + "redis": { + "unix_socket_path": "/var/run/redis/redis.sock", + "host": "redis-host", + "port": 6379, + "prefix": "fishroom" + }, + "irc": { + "server": "irc.freenode.net", + "port": 6697, + "nick": "XiaoT", + "password": null, + "ssl": true, + "blacklist": [ + "[Olaf]" + ] + }, + "telegram": { + "token": "", + "me": null, + "admin": [] + }, + "xmpp": { + "server": "xmpp.jp", + "port": 5222, + "jid": "user@xmpp.jp/resource", + "password": "", + "nick": "XiaoT" + }, + "gitter": { + "token": "", + "me": "" + }, + "matrix": { + "server": "https://matrixim.cc:8448", + "user": "fishroom", + "password": "", + "nick": "bot_fishroom", + "bot_msg_pattern": "^mubot|^!wikipedia" + }, + "wechat": {}, + "qiniu": { + "access_key": "", + "secret_key": "", + "bucket": "", + "base_url": "" + }, + "photo_store": { + "provider": "vim-cn", + "options": { + "client_id": "" + } + }, + "chatlog": { + "host": "tornado-host", + "port": 8000, + "default_channel": "teleboto-dev" + }, + "file_store": { + "provider": "qiniu" + }, + "text_store": { + "provider": "vinergy", + "options": {} + }, + "plugins": [ + "pia", + "imglink", + "vote", + "hualao" + ], + "bindings": { + "archlinux-cn": { + "irc": "#archlinux-cn", + "telegram": "-1001031857103", + "xmpp": "chat@conference.xmpp.jp", + "matrix": "#archlinux:matrixim.cc" + }, + "test": { + "wechat": "xxx chat room" + } + } +} diff --git a/requirements.txt b/requirements.txt index e34daa0..62ddcb4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ pytz redis -marshmallow==2.1.0 -tornado==4.5.2 +marshmallow==2.15.1 +tornado==6.0.3 tornado-redis irc requests @@ -10,6 +10,6 @@ pillow qiniu python-magic dateutils -aiohttp==2.3.3 +aiohttp==3.5.4 matrix-client itchat