From 7f2b744a5339b7f6b8e23db563c2c63623b0808f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 17 Jul 2025 13:09:30 -0400 Subject: [PATCH] Closes #18528: Introduce HOSTNAME config parameter (#19894) --- docs/configuration/system.md | 10 ++++++++++ netbox/netbox/settings.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/configuration/system.md b/docs/configuration/system.md index 28ea141c2..f2e5765f0 100644 --- a/docs/configuration/system.md +++ b/docs/configuration/system.md @@ -72,6 +72,16 @@ Email is sent from NetBox only for critical events or if configured for [logging --- +## HOSTNAME + +!!! info "This parameter was introduced in NetBox v4.4." + +Default: System hostname + +The hostname displayed in the user interface identifying the system on which NetBox is running. If not defined, this defaults to the system hostname as reported by Python's `platform.node()`. + +--- + ## HTTP_PROXIES Default: `None` diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 239b5978f..d293a9979 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -27,7 +27,6 @@ from utilities.string import trailing_slash RELEASE = load_release_data() VERSION = RELEASE.full_version # Retained for backward compatibility -HOSTNAME = platform.node() # Set the base directory two levels up BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -125,6 +124,7 @@ EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', []) FIELD_CHOICES = getattr(configuration, 'FIELD_CHOICES', {}) FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(configuration, 'FILE_UPLOAD_MAX_MEMORY_SIZE', 2621440) GRAPHQL_MAX_ALIASES = getattr(configuration, 'GRAPHQL_MAX_ALIASES', 10) +HOSTNAME = getattr(configuration, 'HOSTNAME', platform.node()) HTTP_PROXIES = getattr(configuration, 'HTTP_PROXIES', {}) INTERNAL_IPS = getattr(configuration, 'INTERNAL_IPS', ('127.0.0.1', '::1')) ISOLATED_DEPLOYMENT = getattr(configuration, 'ISOLATED_DEPLOYMENT', False)