lilydjwg / luoxu

A Telegram userbot to index Chinese and Japanese group contents.
GNU General Public License v3.0
251 stars 24 forks source link

Support reading config from environment variables #7

Open berberman opened 1 year ago

berberman commented 1 year ago

从环境变量传入的配置可覆盖配置文件中的对应项,这将有助于模块化配置。设置以下环境变量可达到与配置文件示例的相同效果:

TELEGRAM_API_ID="10000" \
TELEGRAM_API_HASH="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
TELEGRAM_ACCOUNT="+1234567890" \
TELEGRAM_SESSION_DB="mybot" \
TELEGRAM_PROXY="127.0.0.1,1080" \
TELEGRAM_INDEX_GROUPS="1000000000, 1000000001" \
DATABASE_URL="postgresql:///luoxu" \
WEB_LISTEN_HOST="localhost" \
WEB_LISTEN_PORT=9008 \
WEB_PREFIX="/luoxu" \
WEB_CACHE_DIR="cache" \
WEB_DEFAULT_AVATAR="nobody.jpg" \
WEB_GHOST_AVATAR="ghost.jpg" \
WEB_ORIGINS="http://localhost"
lilydjwg commented 1 year ago

No. These values will be passed into every child processes. Also it takes space.