Feature Request: Customizable Instance Name / Page Title

#5477 Docker environment INSTANCE_NAME to add title suffix
This commit is contained in:
Arthur 2026-05-08 18:50:12 +02:00
parent 34374cbe09
commit d92329bde5
5 changed files with 27 additions and 2 deletions

View file

@ -39,6 +39,9 @@ EXPOSE 80 81 443
COPY backend /app
COPY frontend/dist /app/frontend
COPY docker/scripts/entrypoint /entrypoint
RUN chmod +x /entrypoint
WORKDIR /app
RUN yarn install \
&& yarn cache clean
@ -52,7 +55,7 @@ RUN rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/frontend /etc/nginx/conf.d/de
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager
VOLUME [ "/data" ]
ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/entrypoint" ]
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.license="MIT" \

View file

@ -0,0 +1,8 @@
#!/bin/sh
set -e
# Create env.js
echo "window.INSTANCE_NAME='${INSTANCE_NAME}';" > /app/frontend/env.js
# Start original init
exec /init

View file

@ -36,10 +36,14 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<!-- ENV -->
<script>
if (global === undefined) {
var global = window;
}
if (window.INSTANCE_NAME) {
document.title = document.title + " - " + window.INSTANCE_NAME;
}
</script>
</body>
</html>

View file

@ -10,6 +10,7 @@ export function SiteHeader() {
const { data: currentUser } = useUser("me");
const isAdmin = currentUser?.roles.includes("admin");
const { logout } = useAuthState();
const instanceName = (window as any).INSTANCE_NAME ? " - " + (window as any).INSTANCE_NAME : "";
return (
<header className="navbar navbar-expand-md d-print-none">
@ -36,7 +37,7 @@ export function SiteHeader() {
alt="Logo"
/>
</div>
Nginx Proxy Manager
Nginx Proxy Manager{instanceName}
</NavLink>
</div>
<div className="navbar-nav flex-row order-md-last">

View file

@ -46,6 +46,15 @@ export default defineConfig({
typescript: true,
}),
tsconfigPaths(),
{
name: 'html-transform',
transformIndexHtml(html) {
return html.replace(
'<!-- ENV -->',
'<script src="/env.js"></script>',
)
},
}
],
server: {
host: true,