Allow customizable hostname setting to be configured #10714

Closed
opened 2025-12-29 21:35:08 +01:00 by adam · 1 comment
Owner

Originally created by @markh0338 on GitHub (Jan 29, 2025).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

4.1.11

Feature type

Change to existing functionality

Proposed functionality

Currently, the HOSTNAME variable is set to use only platform.node() as its value. While this is sufficient in most cases, providing an option for customization would be beneficial. To avoid conflicts with #18518, it may be best to introduce a DISPLAY_NAME variable that can accept a custom value or default to HOSTNAME. This ensures that the meta tags from #18518 reflect the actual server name while allowing the DISPLAY_NAME to be customized.

Addition to settings.py:
DISPLAY_NAME = getattr(configuration, 'DISPLAY_NAME', HOSTNAME)
or
DISPLAY_NAME = getattr(configuration, 'DISPLAY_NAME', platform.node())

Modification in the footer section of base/layout.html:
<li class="list-inline-item">{{ settings.HOSTNAME }}</li>
would be come:
<li class="list-inline-item">{{ settings.DISPLAY_NAME }}</li>

Use case

In certain use cases, the server's hostname is not customizable and is displayed in the footer section of all NetBox pages, which may be unclear or confusing to end users. Making this setting customizable would allow administrators to define a value that better suits their environment or leave it unset to use the default value.

Database changes

N/A

External dependencies

N/A

Originally created by @markh0338 on GitHub (Jan 29, 2025). Originally assigned to: @jeremystretch on GitHub. ### NetBox version 4.1.11 ### Feature type Change to existing functionality ### Proposed functionality Currently, the **HOSTNAME** variable is set to use only **platform.node()** as its value. While this is sufficient in most cases, providing an option for customization would be beneficial. To avoid conflicts with #18518, it may be best to introduce a **DISPLAY_NAME** variable that can accept a custom value or default to **HOSTNAME**. This ensures that the meta tags from #18518 reflect the actual server name while allowing the **DISPLAY_NAME** to be customized. Addition to settings.py: `DISPLAY_NAME = getattr(configuration, 'DISPLAY_NAME', HOSTNAME)` or `DISPLAY_NAME = getattr(configuration, 'DISPLAY_NAME', platform.node())` Modification in the footer section of base/layout.html: `<li class="list-inline-item">{{ settings.HOSTNAME }}</li>` would be come: `<li class="list-inline-item">{{ settings.DISPLAY_NAME }}</li>` ### Use case In certain use cases, the server's hostname is not customizable and is displayed in the footer section of all NetBox pages, which may be unclear or confusing to end users. Making this setting customizable would allow administrators to define a value that better suits their environment or leave it unset to use the default value. ### Database changes N/A ### External dependencies N/A
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:35:08 +01:00
adam closed this issue 2025-12-29 21:35:08 +01:00
Author
Owner

@bobbwest commented on GitHub (Feb 5, 2025):

This would be especially helpful when running under docker, when the hostname is shown as the docker container ID.

@bobbwest commented on GitHub (Feb 5, 2025): This would be especially helpful when running under docker, when the hostname is shown as the docker container ID.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10714