From 4ed70beabc73dd9aa1d2e06ab5902ded0801c404 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 4 Mar 2022 16:49:41 +0100 Subject: chore: use a different configuration depending on app env It will be useful with Docker. Instead of cloning the project with a different configuration, I can manage two different configuration thanks to dotenv and some checking inside the app. --- src/utils/helpers/rss.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/utils/helpers/rss.ts') diff --git a/src/utils/helpers/rss.ts b/src/utils/helpers/rss.ts index e10c7f3..10a8e77 100644 --- a/src/utils/helpers/rss.ts +++ b/src/utils/helpers/rss.ts @@ -15,11 +15,10 @@ const getAllPosts = async (): Promise => { }; export const generateFeed = async () => { - const websiteUrl = `${process.env.NEXT_PUBLIC_APP_PROTOCOL}://${process.env.NEXT_PUBLIC_APP_DOMAIN}`; const author = { name: settings.name, email: process.env.APP_AUTHOR_EMAIL, - link: websiteUrl, + link: settings.url, }; const copyright = `${settings.name} CC BY SA ${settings.copyright.startYear} - ${settings.copyright.endYear}`; const title = `${settings.name} | ${settings.baseline.fr}`; @@ -29,13 +28,13 @@ export const generateFeed = async () => { copyright, description: process.env.APP_FEED_DESCRIPTION, feedLinks: { - json: `${websiteUrl}/feed/json`, - atom: `${websiteUrl}/feed/atom`, + json: `${settings.url}/feed/json`, + atom: `${settings.url}/feed/atom`, }, generator: 'Feed & NextJS', - id: websiteUrl, + id: settings.url, language: settings.locales.defaultLocale, - link: websiteUrl, + link: settings.url, title, }); @@ -47,7 +46,7 @@ export const generateFeed = async () => { date: new Date(post.dates.publication), description: post.intro, id: post.id, - link: `${websiteUrl}/article/${post.slug}`, + link: `${settings.url}/article/${post.slug}`, title: post.title, }); }); -- cgit v1.2.3