-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
86 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .django import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import os | ||
import re | ||
|
||
import environ | ||
|
||
env = environ.Env() | ||
django_root = environ.Path(__file__) - 2 | ||
|
||
ENV_FILE = env.str("ENV_FILE", default=django_root(".env")) | ||
if os.path.exists(ENV_FILE): | ||
environ.Env.read_env(ENV_FILE) | ||
|
||
# per default production is enabled for security reasons | ||
# for development create .env file with ENV=development | ||
ENV = env.str("ENV", "production") | ||
|
||
|
||
def default(default_dev=env.NOTSET, default_prod=env.NOTSET): | ||
"""Environment aware default.""" | ||
return default_prod if ENV == "production" else default_dev | ||
|
||
|
||
ADMIN_USERNAME = env.str("ADMIN_USERNAME", default="admin") | ||
|
||
# Authentication | ||
OIDC_OP_USER_ENDPOINT = env.str("OIDC_OP_USER_ENDPOINT", default=None) | ||
OIDC_OP_TOKEN_ENDPOINT = "not supported in alexandria, but a value is needed" | ||
OIDC_VERIFY_SSL = env.bool("OIDC_VERIFY_SSL", default=True) | ||
OIDC_USERNAME_CLAIM = env.str("OIDC_USERNAME_CLAIM", default="sub") | ||
OIDC_GROUPS_CLAIM = env.str("OIDC_GROUPS_CLAIM", default="alexandria_groups") | ||
OIDC_BEARER_TOKEN_REVALIDATION_TIME = env.int( | ||
"OIDC_BEARER_TOKEN_REVALIDATION_TIME", default=0 | ||
) | ||
OIDC_OP_INTROSPECT_ENDPOINT = env.str("OIDC_OP_INTROSPECT_ENDPOINT", default=None) | ||
OIDC_RP_CLIENT_ID = env.str("OIDC_RP_CLIENT_ID", default=None) | ||
OIDC_RP_CLIENT_SECRET = env.str("OIDC_RP_CLIENT_SECRET", default=None) | ||
|
||
DEV_AUTH_BACKEND = env.bool("DEV_AUTH_BACKEND", default=False) | ||
OIDC_DRF_AUTH_BACKEND = env.str( | ||
"OIDC_DRF_AUTH_BACKEND", | ||
default="alexandria.oidc_auth.authentication.AlexandriaAuthenticationBackend", | ||
) | ||
if DEV_AUTH_BACKEND: | ||
OIDC_DRF_AUTH_BACKEND = ( | ||
"alexandria.oidc_auth.authentication.DevelopmentAuthenticationBackend" | ||
) | ||
|
||
|
||
# Extensions | ||
|
||
VISIBILITY_CLASSES = env.list( | ||
"VISIBILITY_CLASSES", default=default(["alexandria.core.visibilities.Any"]) | ||
) | ||
|
||
PERMISSION_CLASSES = env.list( | ||
"PERMISSION_CLASSES", default=default(["alexandria.core.permissions.AllowAny"]) | ||
) | ||
VALIDATION_CLASSES = env.list("VALIDATION_CLASSES", default=[]) | ||
|
||
|
||
# Storage | ||
MEDIA_STORAGE_SERVICE = env.str("MEDIA_STORAGE_SERVICE", default="minio") | ||
MINIO_STORAGE_ENDPOINT = env.str("MINIO_STORAGE_ENDPOINT", default="minio:9000") | ||
MINIO_STORAGE_ACCESS_KEY = env.str("MINIO_STORAGE_ACCESS_KEY", default="minio") | ||
MINIO_STORAGE_SECRET_KEY = env.str("MINIO_STORAGE_SECRET_KEY", default="minio123") | ||
MINIO_STORAGE_USE_HTTPS = env.str("MINIO_STORAGE_USE_HTTPS", default=False) | ||
MINIO_STORAGE_MEDIA_BUCKET_NAME = env.str( | ||
"MINIO_STORAGE_MEDIA_BUCKET_NAME", default="alexandria-media" | ||
) | ||
MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = env.str( | ||
"MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET", default=True | ||
) | ||
MINIO_PRESIGNED_TTL_MINUTES = env.str("MINIO_PRESIGNED_TTL_MINUTES", default=15) | ||
|
||
|
||
# Thumbnails | ||
ENABLE_THUMBNAIL_GENERATION = env.bool("ENABLE_THUMBNAIL_GENERATION", default=True) | ||
THUMBNAIL_WIDTH = env.int("THUMBNAIL_WIDTH", default=None) | ||
THUMBNAIL_HEIGHT = env.int("THUMBNAIL_HEIGHT", default=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters