Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" \
Expand Down
8 changes: 8 additions & 0 deletions docker/scripts/entrypoint
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
3 changes: 2 additions & 1 deletion frontend/src/components/SiteHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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">
Expand Down
9 changes: 9 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down