Backmerge hotfix : v0.117.11 (#1345)
* Apply hotfix changes (#1336) * Apply hotfix changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: updated config * fix: updated runtime config * fix: updated runtime config --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Apply hotfix changes * sonar permission related fix --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -34,6 +34,15 @@ COPY --from=builder /app/build /usr/share/nginx/html
|
||||
# Copy custom NGINX configuration
|
||||
COPY --from=builder /app/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Create config directory and set permissions
|
||||
RUN mkdir -p /usr/share/nginx/html/config && \
|
||||
chown nginx:nginx /usr/share/nginx/html/config && \
|
||||
chmod 755 /usr/share/nginx/html/config
|
||||
|
||||
# Copy the environment script
|
||||
COPY ../frontend/generate-runtime-config.sh /docker-entrypoint.d/40-env.sh
|
||||
RUN chmod +x /docker-entrypoint.d/40-env.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
USER nginx
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
# This script generates a runtime config file with environment variables
|
||||
# It will be executed when the container starts
|
||||
|
||||
# Create config directory if it doesn't exist
|
||||
mkdir -p /usr/share/nginx/html/config
|
||||
|
||||
# Generate the runtime-config.js file with the current environment variables
|
||||
cat > /usr/share/nginx/html/config/runtime-config.js << EOF
|
||||
// This file is auto-generated at runtime. Do not modify manually.
|
||||
|
||||
@@ -13,23 +13,5 @@
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<script type="module">
|
||||
// Set favicon dynamically based on configuration
|
||||
import config from '../src/config.js';
|
||||
|
||||
// Create a new link element for the favicon
|
||||
const faviconLink = document.createElement('link');
|
||||
faviconLink.rel = 'icon';
|
||||
faviconLink.type = 'image/svg+xml';
|
||||
faviconLink.href = config.favicon;
|
||||
|
||||
// Replace any existing favicon or add if none exists
|
||||
const existingFavicon = document.querySelector('link[rel="icon"]');
|
||||
if (existingFavicon) {
|
||||
document.head.removeChild(existingFavicon);
|
||||
}
|
||||
document.head.appendChild(faviconLink);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { GenericLoader } from "./components/generic-loader/GenericLoader";
|
||||
import { LazyLoader } from "./components/widgets/lazy-loader/LazyLoader.jsx";
|
||||
import { SocketProvider } from "./helpers/SocketContext.js";
|
||||
import "./index.css";
|
||||
import config from "./config.js";
|
||||
|
||||
const enablePosthog = process.env.REACT_APP_ENABLE_POSTHOG;
|
||||
if (enablePosthog !== "false") {
|
||||
@@ -22,6 +23,20 @@ if (enablePosthog !== "false") {
|
||||
});
|
||||
}
|
||||
|
||||
// Utility to set favicon
|
||||
function setFavicon(url) {
|
||||
let link = document.querySelector("link[rel~='icon']");
|
||||
if (!link) {
|
||||
link = document.createElement("link");
|
||||
link.rel = "icon";
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
link.href = url;
|
||||
}
|
||||
|
||||
// Call this after config is loaded
|
||||
setFavicon(config.favicon);
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
|
||||
Reference in New Issue
Block a user