Reorganize repos
This commit is contained in:
61
config.py
Normal file
61
config.py
Normal file
@ -0,0 +1,61 @@
|
||||
import os
|
||||
import importlib.metadata
|
||||
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
class BaseConfig(object):
|
||||
"""Base configuration."""
|
||||
|
||||
APP_NAME = "HSMAN"
|
||||
APP_VERSION = os.getenv('APP_VERSION', "0.0alpha1")
|
||||
APP_SHA = os.getenv('APP_SHA', "000000")
|
||||
APP_PREFIX = os.getenv('APP_PREFIX', '')
|
||||
DEBUG_TB_ENABLED = False
|
||||
WTF_CSRF_ENABLED = False
|
||||
|
||||
# All the followinf vars can be overriden
|
||||
# in the environment, using `HSMAN_` prefix
|
||||
SECRET_KEY = "secreto"
|
||||
ADMIN_GROUPS = ["adminGroup"]
|
||||
OIDC_CLIENT_ID = 'client-id'
|
||||
OIDC_CLIENT_SECRET = 'client-secreto'
|
||||
OIDC_URL = "https://myidp.example.com/auth"
|
||||
OIDC_REDIRECT_URI = 'http://localhost:5000/auth'
|
||||
|
||||
# These are required by hsapi, should not be defined here
|
||||
# HSAPI_SERVER = "https://headscale.example.com"
|
||||
# HSAPI_API_TOKEN = 'hs-apikey'
|
||||
|
||||
@staticmethod
|
||||
def configure(app):
|
||||
# Implement this method to do further configuration on your app.
|
||||
pass
|
||||
|
||||
|
||||
class DevelopmentConfig(BaseConfig):
|
||||
"""Development configuration."""
|
||||
|
||||
DEBUG = True
|
||||
ENVIRONMENT = "develop"
|
||||
|
||||
|
||||
class TestingConfig(BaseConfig):
|
||||
"""Testing configuration."""
|
||||
|
||||
TESTING = True
|
||||
PRESERVE_CONTEXT_ON_EXCEPTION = False
|
||||
ENVIRONMENT = "test"
|
||||
|
||||
|
||||
class ProductionConfig(BaseConfig):
|
||||
"""Production configuration."""
|
||||
|
||||
ENVIRONMENT = "production"
|
||||
WTF_CSRF_ENABLED = True
|
||||
|
||||
|
||||
config = dict(
|
||||
development=DevelopmentConfig,
|
||||
testing=TestingConfig,
|
||||
production=ProductionConfig)
|
Reference in New Issue
Block a user