Skip to content

Commit

Permalink
Merge pull request #575 from GenomicDataInfrastructure/ART-12303-user…
Browse files Browse the repository at this point in the history
…portal-frontend-custom-text-and-links-are-not-displayed

fix: ART-12303/custom text not displayed
  • Loading branch information
jadzlnds authored Feb 6, 2025
2 parents 55cb3b0 + 82584b2 commit 4ec230e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ENV NODE_ENV="production"
# ENV NEXT_TELEMETRY_DISABLED="1"

COPY --from=builder /app/public ./public

COPY --from=builder /app/scripts ./scripts

# Ensure no write permissions for executable directories
COPY --from=builder --chown=1001:1001 /app/.next/standalone ./
Expand Down Expand Up @@ -64,4 +64,4 @@ LABEL org.opencontainers.image.description="${APP_DESCRIPTION}"
LABEL io.k8s.display-name="${APP_TITLE}"
LABEL io.k8s.description="${APP_DESCRIPTION}"

CMD ["node", "server.js"]
CMD ["node", "scripts/start.js"]
29 changes: 29 additions & 0 deletions scripts/generate-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0
const fs = require("fs");
const path = require("path");

function loadProperties() {
const propertiesPath = path.join(process.cwd(), "public", "properties.json");
try {
const properties = JSON.parse(fs.readFileSync(propertiesPath, "utf8"));

Object.entries(properties).forEach(([key, value]) => {
process.env[key] = value;
});

console.log(
"Environment variables loaded successfully from properties.json"
);
} catch (error) {
console.error("Error loading properties:", error);
process.exit(1);
}
}

module.exports = loadProperties;

if (require.main === module) {
loadProperties();
}
27 changes: 27 additions & 0 deletions scripts/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0
const loadProperties = require("./generate-env");
const { spawn } = require("child_process");

loadProperties();

const server = spawn("node", ["server.js"], {
stdio: "inherit",
env: process.env,
});

server.on("error", (err) => {
console.error("Failed to start server:", err);
process.exit(1);
});

["SIGINT", "SIGTERM"].forEach((signal) => {
process.on(signal, () => {
server.kill(signal);
});
});

server.on("exit", (code) => {
process.exit(code);
});
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ sonar.projectKey=GenomicDataInfrastructure_gdi-userportal-frontend
sonar.organization=genomicdatainfrastructure
sonar.qualitygate.wait=true
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.exclusions= **/*.test.ts, e2e/*,**/*.tsx,**/*Repository.ts,src/config/*,src/app/about/renderer.ts,**/*.json,**/instrumentation*,src/app/api/**/schemas.ts
sonar.exclusions= **/*.test.ts, e2e/*,**/*.tsx,**/*Repository.ts,src/config/*,src/app/about/renderer.ts,**/*.json,**/instrumentation*,src/app/api/**/schemas.ts,scripts/**/*
sonar.test.inclusions= **/*.test.ts
29 changes: 15 additions & 14 deletions src/config/contentConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2024 PNED G.I.E.
//
// SPDX-License-Identifier: Apache-2.0
import config from "../../public/properties.json";
import { env } from "next-runtime-env";

interface ContentConfig {
linkedInUrl?: string;
Expand All @@ -21,27 +21,28 @@ interface ContentConfig {
}

const contentConfig: ContentConfig = {
linkedInUrl: config.NEXT_PUBLIC_LINKEDIN_URL,
twitterUrl: config.NEXT_PUBLIC_TWITTER_URL,
githubUrl: config.NEXT_PUBLIC_GITHUB_URL,
websiteUrl: config.NEXT_PUBLIC_WEBSITE_URL,
email: config.NEXT_PUBLIC_EMAIL,
linkedInUrl: env("NEXT_PUBLIC_LINKEDIN_URL"),
twitterUrl: env("NEXT_PUBLIC_TWITTER_URL"),
githubUrl: env("NEXT_PUBLIC_GITHUB_URL"),
gitlabUrl: env("NEXT_PUBLIC_GITLAB_URL"),
websiteUrl: env("NEXT_PUBLIC_WEBSITE_URL"),
email: env("NEXT_PUBLIC_EMAIL"),
footerText:
config.NEXT_PUBLIC_FOOTER_TEXT ||
env("NEXT_PUBLIC_FOOTER_TEXT") ||
"GDI project receives funding from the European Union's Digital Europe \n Programme under grant agreement number 101081813.",
homepageTitle: config.NEXT_PUBLIC_HOMEPAGE_TITLE || "WELCOME TO GDI",
homepageTitle: env("NEXT_PUBLIC_HOMEPAGE_TITLE") || "WELCOME TO GDI",
homepageSubtitle:
config.NEXT_PUBLIC_HOMEPAGE_SUBTITLE ||
env("NEXT_PUBLIC_HOMEPAGE_SUBTITLE") ||
"The Genomic Data Infrastructure (GDI) project is enabling access to genomic and related phenotypic and clinical data across Europe.",
aboutContent:
config.NEXT_PUBLIC_HOMEPAGE_ABOUT_CONTENT ||
env("NEXT_PUBLIC_HOMEPAGE_ABOUT_CONTENT") ||
"The Genomic Data Infrastructure (GDI) homepage is your gateway to an extensive network of genomic data designed to revolutionize research, policymaking, and healthcare in Europe. The GDI project aims to provide seamless access to over one million genome sequences, facilitating groundbreaking advancements in personalized medicine for various diseases, including cancer and rare conditions. By integrating genomic, phenotypic, and clinical data, GDI supports precise diagnostics, treatments, and clinical decision-making. Explore our user-friendly platform to connect with crucial datasets, and join our mission to enhance healthcare outcomes and foster innovation across Europe. Visit the GDI website for more information.",
bannerLink: config.NEXT_PUBLIC_BANNER_LINK || "/howto",
siteTitle: config.NEXT_PUBLIC_SITE_TITLE || "GDI - User Portal",
bannerLink: env("NEXT_PUBLIC_BANNER_LINK") || "/howto",
siteTitle: env("NEXT_PUBLIC_SITE_TITLE") || "GDI - User Portal",
siteDescription:
config.NEXT_PUBLIC_SITE_DESCRIPTION ||
env("NEXT_PUBLIC_SITE_DESCRIPTION") ||
"Genomic Data Infrastructure User Portal",
showBasketAndLogin: config.NEXT_PUBLIC_SHOW_BASKET_AND_LOGIN !== "false",
showBasketAndLogin: env("NEXT_PUBLIC_SHOW_BASKET_AND_LOGIN") !== "false",
};

export default contentConfig;

0 comments on commit 4ec230e

Please sign in to comment.