fix: allow redis details to be retrieved from environment variables

pull/259/head
Ruiwen Chua 2019-01-03 15:10:39 +08:00
parent 96bd047747
commit 77c37b7cd6
1 changed files with 5 additions and 3 deletions

View File

@ -19,12 +19,14 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import redis import redis
import hashlib import hashlib
port = 6379 port = int(os.getenv("REDIS_PORT")) if os.getenv("REDIS_PORT") else 6379
hostname = '127.0.0.1' hostname = os.getenv("REDIS_BACKEND") or '127.0.0.1'
db = 5 db = int(os.getenv("REDIS_DATABASE")) if os.getenv("REDIS_DATABASE") else 0
def selftest(enable=True): def selftest(enable=True):