You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB
Python

2 years ago
from pathlib import Path
from json import loads
from secrets import token_urlsafe
from os import getenv
from dotenv import load_dotenv
load_dotenv()
# Site meta
SITE_NAME = getenv('SITE_NAME', 'Flipbook')
SECRET_KEY = getenv('SECRET_KEY', token_urlsafe(12))
SERVER_NAME = getenv('SERVER_NAME', '127.0.0.1:5000')
# Web3
WEB3_PROVIDER_URI = getenv('WEB3_PROVIDER_URI')
CONTRACT_ABI = loads(Path('flipbook/library/abi/flipbook.json').open().read())
CONTRACT_ADDRESS = getenv('CONTRACT_ADDRESS')
# Uploads
MAX_CONTENT_LENGTH = 50 * 1024 * 1024
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'svg'}
UPLOADS_PATH = getenv('UPLOADS_PATH', 'data/uploads')
SESSION_LIFETIME = getenv('SESSION_LIFETIME', 30)
# Database
DB_HOST = getenv('DB_HOST', 'localhost')
DB_PORT = getenv('DB_PORT', 5432)
DB_NAME = getenv('DB_NAME', 'flipbook')
DB_USER = getenv('DB_USER', 'flipbook')
DB_PASS = getenv('DB_PASS')
# Redis
REDIS_HOST = getenv('REDIS_HOST', 'localhost')
REDIS_PORT = getenv('REDIS_PORT', 6379)
# Development
TEMPLATES_AUTO_RELOAD = True
DEBUG = False
if SERVER_NAME == '127.0.0.1:5000':
DEBUG = True
# Twitter
TWITTER_CONSUMER_KEY = getenv('TWITTER_CONSUMER_KEY', None)
TWITTER_CONSUMER_SECRET = getenv('TWITTER_CONSUMER_SECRET', None)
TWITTER_ACCESS_TOKEN = getenv('TWITTER_ACCESS_TOKEN', None)
TWITTER_ACCESS_SECRET = getenv('TWITTER_ACCESS_SECRET', None)