MCPcopy Create free account
hub / github.com/alephdata/aleph / __init__

Method __init__

aleph/settings.py:20–344  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

18
19class Settings:
20 def __init__(self) -> None:
21 # The aleph module directory
22 self.APP_DIR = os.path.abspath(os.path.dirname(__file__))
23
24 # Show error messages to the user.
25 self.DEBUG = env.to_bool("ALEPH_DEBUG", False)
26 # Profile requests
27 self.PROFILE = env.to_bool("ALEPH_PROFILE", False)
28 # Propose HTTP caching to the user agents.
29 self.CACHE = env.to_bool("ALEPH_CACHE", not self.DEBUG)
30 # Puts the system into read-only mode and displays a warning.
31 self.MAINTENANCE = env.to_bool("ALEPH_MAINTENANCE", False)
32 # Unit test context.
33 self.TESTING = False
34
35 ###############################################################################
36 # General instance information
37
38 self.APP_TITLE = env.get("ALEPH_APP_TITLE", lazy_gettext("Aleph"))
39 self.APP_NAME = env.get("ALEPH_APP_NAME", "aleph")
40 self.APP_UI_URL = env.get("ALEPH_UI_URL", "http://localhost:8080/")
41 self.APP_LOGO = env.get("ALEPH_LOGO", "/static/logo.png")
42 self.APP_LOGO_AR = env.get("ALEPH_LOGO_AR", self.APP_LOGO)
43 self.APP_FAVICON = env.get("ALEPH_FAVICON", "/static/favicon.png")
44
45 # Show a system-wide banner in the user interface.
46 self.APP_BANNER = env.get("ALEPH_APP_BANNER")
47 self.APP_MESSAGES_URL = env.get("ALEPH_APP_MESSAGES_URL", None)
48
49 # Force HTTPS here:
50 self.FORCE_HTTPS = env.to_bool(
51 "ALEPH_FORCE_HTTPS",
52 True if self.APP_UI_URL.lower().startswith("https") else False,
53 )
54 self.PREFERRED_URL_SCHEME = env.get(
55 "ALEPH_URL_SCHEME", "https" if self.FORCE_HTTPS else "http"
56 )
57 # Apply HTTPS rules to the UI URL:
58 self.APP_PARSED_UI_URL = urlparse(self.APP_UI_URL)._replace(
59 scheme=self.PREFERRED_URL_SCHEME
60 )
61 self.APP_UI_URL = self.APP_PARSED_UI_URL.geturl()
62
63 # Content security policy:
64 self.CONTENT_POLICY = env.get(
65 "ALEPH_CONTENT_POLICY",
66 "default-src: 'self' 'unsafe-inline' 'unsafe-eval' data: *",
67 )
68
69 # Cross-origin resource sharing
70 self.CORS_ORIGINS = env.to_list("ALEPH_CORS_ORIGINS", ["*"], separator="|")
71
72 ##############################################################################
73 # Security and authentication.
74
75 # Required: set a secret key
76 self.SECRET_KEY = env.get("ALEPH_SECRET_KEY")
77

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected