Skip to content

Instantly share code, notes, and snippets.

@legendtang
Last active November 3, 2016 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save legendtang/bef8ae767e892ed2affdb781bb751733 to your computer and use it in GitHub Desktop.
Save legendtang/bef8ae767e892ed2affdb781bb751733 to your computer and use it in GitHub Desktop.
Configuration file for binux/qiandao with env var support.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-07-30 12:21:48
# Modified on 2016-11-03 01:46:00 by @legendtang
import hashlib
import os
debug = True
gzip = True
bind = '0.0.0.0'
port = int(os.getenv('PORT', 80))
https = bool(os.getenv('HTTPS_ENABLE', False))
cookie_days = 5
class mysql(object):
host = os.getenv('MYSQL_PORT_3306_TCP_ADDR', 'localhost')
port = os.getenv('MYSQL_PORT_3306_TCP_PORT', '3306')
database = os.getenv('MYSQL_INSTANCE_NAME', 'qiandao')
user = os.getenv('MYSQL_USERNAME', 'qiandao')
passwd = os.getenv('MYSQL_PASSWORD', None)
class sqlite3(object):
path = './database.db'
db_type = 'mysql'
class redis(object):
host = os.getenv('REDIS_PORT_6379_TCP_ADDR', 'localhost')
port = int(os.getenv('REDIS_PORT_6379_TCP_PORT', 6379))
passwd = os.getenv('REDIS_PASSWORD', None)
db = int(os.getenv('REDIS_DB', 1))
evil = 100
pbkdf2_iterations = 400
aes_key = hashlib.sha256('binux').digest()
cookie_secret = hashlib.sha256('binux').digest()
check_task_loop = 10000
download_size_limit = 1*1024*1024
proxies = []
mailgun_key = os.getenv('MAIGUN_KEY', '')
ga_key = os.getenv('GA_KEY', '')
try:
from local_config import *
except ImportError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment