diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-03-04 16:49:41 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-03-04 16:49:41 +0100 |
| commit | 4ed70beabc73dd9aa1d2e06ab5902ded0801c404 (patch) | |
| tree | 05fb731e5c937be885c6d03f31f40f1f9fd2cf8c /src/utils/helpers/rss.ts | |
| parent | 4378c4553b17d5435b08387d80377bce666dc838 (diff) | |
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.
Diffstat (limited to 'src/utils/helpers/rss.ts')
| -rw-r--r-- | src/utils/helpers/rss.ts | 13 |
1 files changed, 6 insertions, 7 deletions
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<ArticlePreview[]> => { }; 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, }); }); |
