Skip to content

Commit 4c5f216

Browse files
committed
Rename APP_NAME, APP_VERSION, APP_LOG_LEVEL, APP_LOG_FORMAT, PLAIN_LOG_LEVEL settings
1 parent b105ba4 commit 4c5f216

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

plain-admin/plain/admin/views/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_template_context(self) -> dict[str, Any]:
6363
context["render_card"] = lambda card: card().render(self, self.request)
6464
context["time_zone"] = timezone.get_current_timezone_name()
6565
context["view_class"] = self.__class__
66-
context["app_name"] = settings.APP_NAME
66+
context["app_name"] = settings.NAME
6767
context["get_gravatar_url"] = get_gravatar_url
6868
return context
6969

plain-dev/plain/dev/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def setup(self, *, port, hostname, log_level):
7070
}
7171

7272
if log_level:
73+
self.plain_env["PLAIN_FRAMEWORK_LOG_LEVEL"] = log_level.upper()
7374
self.plain_env["PLAIN_LOG_LEVEL"] = log_level.upper()
74-
self.plain_env["APP_LOG_LEVEL"] = log_level.upper()
7575

7676
self.custom_process_env = {
7777
**self.plain_env,

plain-observer/plain/observer/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def ready(self):
3636
# Start our own provider, new sampler, and span processor
3737
resource = Resource.create(
3838
{
39-
service_attributes.SERVICE_NAME: settings.APP_NAME,
40-
service_attributes.SERVICE_VERSION: settings.APP_VERSION,
39+
service_attributes.SERVICE_NAME: settings.NAME,
40+
service_attributes.SERVICE_VERSION: settings.VERSION,
4141
}
4242
)
4343
provider = TracerProvider(sampler=sampler, resource=resource)

plain-observer/plain/observer/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ def from_opentelemetry_spans(cls, spans):
182182
request_id=request_id,
183183
user_id=user_id,
184184
session_id=session_id,
185-
app_name=app_name or getattr(settings, "APP_NAME", ""),
186-
app_version=app_version or getattr(settings, "APP_VERSION", ""),
185+
app_name=app_name or settings.NAME,
186+
app_version=app_version or settings.VERSION,
187187
root_span_name=root_span.name if root_span else "",
188188
)
189189

plain-toolbar/plain/toolbar/toolbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Toolbar:
1313
def __init__(self, context):
1414
self.context = context
1515
self.request = context["request"]
16-
self.version = settings.APP_VERSION
16+
self.version = settings.VERSION
1717

1818
def should_render(self):
1919
if settings.DEBUG:

plain/plain/runtime/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def setup() -> None:
6464
sys.path.insert(0, APP_PATH.parent.as_posix())
6565

6666
configure_logging(
67-
plain_log_level=settings.PLAIN_LOG_LEVEL,
68-
app_log_level=settings.APP_LOG_LEVEL,
69-
app_log_format=settings.APP_LOG_FORMAT,
67+
plain_log_level=settings.FRAMEWORK_LOG_LEVEL,
68+
app_log_level=settings.LOG_LEVEL,
69+
app_log_format=settings.LOG_FORMAT,
7070
)
7171

7272
packages_registry.populate(settings.INSTALLED_PACKAGES)

plain/plain/runtime/global_settings.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
by the PLAIN_SETTINGS_MODULE environment variable.
44
"""
55

6-
from os import environ
7-
86
from .utils import get_app_info_from_pyproject
97

108
# MARK: Core Settings
119

1210
DEBUG: bool = False
1311

1412
name, version = get_app_info_from_pyproject()
15-
APP_NAME: str = name
16-
APP_VERSION: str = version
13+
NAME: str = name
14+
VERSION: str = version
1715

1816
# List of strings representing installed packages.
1917
INSTALLED_PACKAGES: list[str] = []
@@ -135,11 +133,10 @@
135133
CSRF_EXEMPT_PATHS: list[str] = []
136134

137135
# MARK: Logging
138-
# (Uses some custom env names in addition to PLAIN_ prefixed )
139136

140-
PLAIN_LOG_LEVEL: str = environ.get("PLAIN_LOG_LEVEL", "INFO")
141-
APP_LOG_LEVEL: str = environ.get("APP_LOG_LEVEL", "INFO")
142-
APP_LOG_FORMAT: str = environ.get("APP_LOG_FORMAT", "keyvalue")
137+
FRAMEWORK_LOG_LEVEL: str = "INFO"
138+
LOG_LEVEL: str = "INFO"
139+
LOG_FORMAT: str = "keyvalue"
143140

144141
# MARK: Assets
145142

0 commit comments

Comments
 (0)