import os

base_dir = os.path.abspath(os.path.dirname(__file__))
postgres_local_base = 'postgresql://localhost/'
database_name = 'hello_books'


class BaseConfig:
	DEBUG = False
	SECRET_KEY = os.getenv('SECRET_KEY', 'my_very_very_VERY_loooong_password')
	SQLALCHEMY_TRACK_MODIFICATIONS = False
	AUTH_TOKEN_EXPIRY_DAYS = 30
	AUTH_TOKEN_EXPIRY_SECONDS = 3000


class DevelopmentConfig(BaseConfig):
	"""
	Development application configuration
	"""
	DEBUG = True
	SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', postgres_local_base + database_name + '_db')
	AUTH_TOKEN_EXPIRY_DAYS = 1
	AUTH_TOKEN_EXPIRY_SECONDS = 20


class TestingConfig(BaseConfig):
	"""
	Testing application configuration
	"""
	DEBUG = True
	TESTING = True
	SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL_TEST', postgres_local_base + 'test_' + database_name)
	AUTH_TOKEN_EXPIRY_DAYS = 0
	AUTH_TOKEN_EXPIRY_SECONDS = 3
	AUTH_TOKEN_EXPIRATION_TIME_DURING_TESTS = 5


class ProductionConfig(BaseConfig):
	"""
	Production application configuration
	"""
	DEBUG = True
	SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', postgres_local_base + database_name)
	BCRYPT_HASH_PREFIX = 13
	AUTH_TOKEN_EXPIRY_DAYS = 30
	AUTH_TOKEN_EXPIRY_SECONDS = 20
