getting there
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import os, pytz
|
||||
import os
|
||||
|
||||
class Config:
|
||||
DEBUG = False
|
||||
TESTING = False
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
SECRET_KEY = os.getenv('FLASK_SECRET_KEY', 'default-insecure-key')
|
||||
SECRET_KEY = os.getenv('FLASK_SECRET_KEY', 'insecure-default-key')
|
||||
|
||||
# Database connection info
|
||||
DB_HOST = os.getenv('DB_HOST', 'localhost')
|
||||
DB_PORT = int(os.getenv('DB_PORT', '3306'))
|
||||
DB_USER = os.getenv('DB_USER', 'radiususer')
|
||||
DB_PASSWORD = os.getenv('DB_PASSWORD', 'radiuspass')
|
||||
DB_NAME = os.getenv('DB_NAME', 'radius')
|
||||
|
||||
# Logging
|
||||
LOG_TO_FILE = os.getenv('LOG_TO_FILE', 'false').lower() == 'true'
|
||||
@@ -14,33 +20,18 @@ class Config:
|
||||
OUI_API_URL = os.getenv('OUI_API_URL', 'https://api.maclookup.app/v2/macs/{}')
|
||||
OUI_API_KEY = os.getenv('OUI_API_KEY', '')
|
||||
OUI_API_LIMIT_PER_SEC = int(os.getenv('OUI_API_LIMIT_PER_SEC', '2'))
|
||||
OUI_API_DAILY_LIMIT = int(os.getenv('OUI_API_DAILY_LIMIT', '10000'))
|
||||
OUI_API_DAILY_LIMIT = int(os.getenv('OUI_API_DAILY_LIMIT', '10000'))
|
||||
|
||||
# These get set in __init__
|
||||
# Timezone
|
||||
APP_TIMEZONE = os.getenv('APP_TIMEZONE', 'UTC')
|
||||
TZ = pytz.timezone(APP_TIMEZONE)
|
||||
|
||||
def __init__(self):
|
||||
tz_name = os.getenv('APP_TIMEZONE', 'UTC')
|
||||
self.APP_TIMEZONE = tz_name
|
||||
self.TZ = pytz.timezone(tz_name)
|
||||
|
||||
class DevelopmentConfig(Config):
|
||||
"""Development configuration."""
|
||||
DEBUG = True
|
||||
MYSQL_HOST = os.getenv('MYSQL_HOST', '192.168.60.150')
|
||||
MYSQL_USER = os.getenv('MYSQL_USER', 'user_92z0Kj')
|
||||
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', '5B3UXZV8vyrB')
|
||||
MYSQL_DATABASE = os.getenv('MYSQL_DATABASE', 'radius_NIaIuT')
|
||||
|
||||
class ProductionConfig(Config):
|
||||
"""Production configuration."""
|
||||
MYSQL_HOST = os.getenv('MYSQL_HOST')
|
||||
MYSQL_USER = os.getenv('MYSQL_USER')
|
||||
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD')
|
||||
MYSQL_DATABASE = os.getenv('MYSQL_DATABASE')
|
||||
DEBUG = False
|
||||
|
||||
# Use the correct config based on environment
|
||||
# Runtime selection
|
||||
if os.getenv('FLASK_ENV') == 'production':
|
||||
app_config = ProductionConfig
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user