def test_env_as_int(self): self.assertIsNone(env_as_int('DUMMY_ENV', None)) self.assertEqual(0, env_as_int('DUMMY_ENV', 0))
# EMAIL_PORT = env_as_int("DJANGO_EMAIL_PORT", 25) # EMAIL_HOST_USER = env("DJANGO_EMAIL_HOST_USER", '') # EMAIL_HOST_PASSWORD = env("DJANGO_EMAIL_HOST_PASSWORD", '') # EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", '[SUAP-TI] ') # EMAIL_USE_LOCALTIME = env_as_bool("DJANGO_EMAIL_USE_LOCALTIME", False) # EMAIL_USE_TLS = env_as_bool("DJANGO_EMAIL_USE_TLS", False) # EMAIL_USE_SSL = env_as_bool("DJANGO_EMAIL_USE_SSL", False) # EMAIL_SSL_CERTFILE = env("DJANGO_EMAIL_SSL_CERTFILE", None) # EMAIL_SSL_KEYFILE = env("DJANGO_EMAIL_SSL_KEYFILE", None) # EMAIL_TIMEOUT = env_as_int("DJANGO_EMAIL_TIMEOUT", None) # Session SESSION_KEY = env("DJANGO_SESSION_KEY", 'sead_avaportal') SESSION_COOKIE_NAME = env("DJANGO_SESSION_COOKIE_NAME", '%s_sessionid' % SESSION_KEY) SESSION_COOKIE_AGE = env_as_int('DJANGO_SESSION_COOKIE_AGE', 1209600) SESSION_COOKIE_DOMAIN = env('DJANGO_SESSION_COOKIE_DOMAIN', None) SESSION_COOKIE_HTTPONLY = env_as_bool('DJANGO_SESSION_COOKIE_HTTPONLY', False) SESSION_COOKIE_PATH = env("DJANGO_SESSION_COOKIE_PATH", "/") SESSION_COOKIE_SAMESITE = env("DJANGO_SESSION_COOKIE_SAMESITE", 'Lax') SESSION_COOKIE_SECURE = env_as_bool('DJANGO_SESSION_COOKIE_SECURE', False) SESSION_EXPIRE_AT_BROWSER_CLOSE = env_as_bool( 'DJANGO_SESSION_EXPIRE_AT_BROWSER_CLOSE', False) SESSION_FILE_PATH = env('DJANGO_SESSION_FILE_PATH', None) SESSION_SAVE_EVERY_REQUEST = env_as_bool('DJANGO_SESSION_SAVE_EVERY_REQUEST', False) SESSION_SERIALIZER = env("DJANGO_SESSION_SERIALIZER", 'django.contrib.sessions.serializers.JSONSerializer') # SESSION_ENGINE = env("DJANGO_SESSION_ENGINE", 'redis_sessions.session') # SESSION_REDIS = { # 'host': env("DJANGO_SESSION_REDIS_HOST", 'redis'),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'DEFAULT_AUTHENTICATION_CLASSES': ( 'suap_ead.auth.SecretDelegateAuthentication', 'rest_framework.authentication.SessionAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly', ], } # Email EMAIL_BACKEND = env("DJANGO_EMAIL_BACKEND", 'django.core.mail.backends.smtp.EmailBackend') EMAIL_HOST = env("DJANGO_EMAIL_HOST", 'localhost') EMAIL_PORT = env_as_int("DJANGO_EMAIL_PORT", 25) EMAIL_HOST_USER = env("DJANGO_EMAIL_HOST_USER", '') EMAIL_HOST_PASSWORD = env("DJANGO_EMAIL_HOST_PASSWORD", '') EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", '[SEAD] ') EMAIL_USE_LOCALTIME = env_as_bool("DJANGO_EMAIL_USE_LOCALTIME", False) EMAIL_USE_TLS = env_as_bool("DJANGO_EMAIL_USE_TLS", False) EMAIL_USE_SSL = env_as_bool("DJANGO_EMAIL_USE_SSL", False) EMAIL_SSL_CERTFILE = env("DJANGO_EMAIL_SSL_CERTFILE", None) EMAIL_SSL_KEYFILE = env("DJANGO_EMAIL_SSL_KEYFILE", None) EMAIL_TIMEOUT = env_as_int("DJANGO_EMAIL_TIMEOUT", None) # Session session_slug = URL_PATH_PREFIX.replace("/", "") # SESSION_CACHE_ALIAS = env("DJANGO_SESSION_CACHE_ALIAS", 'default') SESSION_COOKIE_AGE = env_as_int('DJANGO_SESSION_COOKIE_AGE', 1209600) SESSION_COOKIE_DOMAIN = env('DJANGO_SESSION_COOKIE_DOMAIN', None)
# # REST Framework # REST_FRAMEWORK = { # 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema', # 'DEFAULT_RENDERER_CLASSES': ['rest_framework.renderers.BrowsableAPIRenderer','rest_framework.renderers.JSONRenderer',], # 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', # 'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.SessionAuthentication',), # 'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',], # } # # Email DEFAULT_FROM_EMAIL = env("DJANGO_DEFAULT_FROM_EMAIL", 'root@localhost') EMAIL_BACKEND = env("DJANGO_EMAIL_BACKEND", 'django.core.mail.backends.smtp.EmailBackend') EMAIL_HOST = env("DJANGO_EMAIL_HOST", 'localhost') EMAIL_PORT = env_as_int("DJANGO_EMAIL_PORT", 25) EMAIL_HOST_USER = env("DJANGO_EMAIL_HOST_USER", '') EMAIL_HOST_PASSWORD = env("DJANGO_EMAIL_HOST_PASSWORD", '') EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", '[SUAP-TI] ') EMAIL_USE_LOCALTIME = env_as_bool("DJANGO_EMAIL_USE_LOCALTIME", False) EMAIL_USE_TLS = env_as_bool("DJANGO_EMAIL_USE_TLS", False) EMAIL_USE_SSL = env_as_bool("DJANGO_EMAIL_USE_SSL", False) EMAIL_SSL_CERTFILE = env("DJANGO_EMAIL_SSL_CERTFILE", None) EMAIL_SSL_KEYFILE = env("DJANGO_EMAIL_SSL_KEYFILE", None) EMAIL_TIMEOUT = env_as_int("DJANGO_EMAIL_TIMEOUT", None) # Session SESSION_KEY = env("DJANGO_SESSION_KEY", 'sead_agendamento') SESSION_COOKIE_NAME = env("DJANGO_SESSION_COOKIE_NAME", '%s_sessionid' % SESSION_KEY) SESSION_COOKIE_AGE = env_as_int('DJANGO_SESSION_COOKIE_AGE', 1209600)
LOGOUT_URL = env("DJANGO_LOGOUT_URL", URL_PATH_PREFIX + 'logout/') LOGIN_REDIRECT_URL = env("DJANGO_LOGIN_REDIRECT_URL", URL_PATH_PREFIX) LOGOUT_REDIRECT_URL = env("DJANGO_LOGOUT_REDIRECT_URL", URL_PATH_PREFIX) AUTH_USER_MODEL = env("DJANGO_AUTH_USER_MODEL", 'auth.User') AUTHENTICATION_BACKENDS = env_as_list( 'DJANGO_AUTHENTICATION_BACKENDS', 'django.contrib.auth.backends.ModelBackend') USE_LDAP = env('LDAP_AUTH_URL', None) is not None if USE_LDAP: LDAP_AUTH_URL = env('LDAP_AUTH_URL', '') LDAP_AUTH_USE_TLS = env_as_bool('LDAP_AUTH_USE_TLS') LDAP_AUTH_SEARCH_BASE = env('LDAP_AUTH_SEARCH_BASE', None) LDAP_AUTH_OBJECT_CLASS = env('LDAP_AUTH_OBJECT_CLASS', 'user') LDAP_AUTH_USER_FIELDS = env_from_json('LDAP_AUTH_USER_FIELDS', None, True) LDAP_AUTH_USER_LOOKUP_FIELDS = env_as_list('LDAP_AUTH_USER_LOOKUP_FIELDS', 'username') LDAP_AUTH_CLEAN_USER_DATA = env('LDAP_AUTH_CLEAN_USER_DATA') LDAP_AUTH_SYNC_USER_RELATIONS = env('LDAP_AUTH_SYNC_USER_RELATIONS') LDAP_AUTH_FORMAT_SEARCH_FILTERS = env('LDAP_AUTH_FORMAT_SEARCH_FILTERS') LDAP_AUTH_ACTIVE_DIRECTORY_DOMAIN = env( 'LDAP_AUTH_ACTIVE_DIRECTORY_DOMAIN') LDAP_AUTH_CONNECT_TIMEOUT = env_as_int('LDAP_AUTH_CONNECT_TIMEOUT', 10) LDAP_AUTH_RECEIVE_TIMEOUT = env_as_int('LDAP_AUTH_RECEIVE_TIMEOUT', 10) LDAP_AUTH_FORMAT_USERNAME = env( 'LDAP_AUTH_FORMAT_USERNAME', 'django_python3_ldap.utils.format_username_active_directory') LDAP_ACTIVE_VALUE = env('LDAP_ACTIVE_VALUE', '512') AUTHENTICATION_BACKENDS = env_as_list( 'DJANGO_AUTHENTICATION_BACKENDS', 'django_python3_ldap.auth.LDAPBackend')