настройка докер-связи с бэком
This commit is contained in:
1 parent
29f788ed9a
commit
9fc422eb02
6 files changed
+47
-15
No files matched your search
@@ -3,10 +3,16 @@ import { resolve, dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const prerenderApiUrl = process.env.PRERENDER_API_URL;
|
||||
|
||||
async function getProducts() {
|
||||
if (!prerenderApiUrl) {
|
||||
console.warn('PRERENDER_API_URL is not configured; skipping product pre-rendering.');
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('https://pvh.projects.rustprogersteam.ru/api/productList');
|
||||
const response = await fetch(`${prerenderApiUrl.replace(/\/$/, '')}/productList`);
|
||||
const data = await response.json();
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
@@ -215,7 +221,8 @@ ${urls.map(item => ` <url>
|
||||
</urlset>`;
|
||||
}
|
||||
|
||||
const sitemapContent = generateSitemap(urls, 'https://pvh.projects.rustprogersteam.ru');
|
||||
const sitemapBaseUrl = process.env.SITE_URL?.replace(/\/$/, '') || 'http://localhost:5173';
|
||||
const sitemapContent = generateSitemap(urls, sitemapBaseUrl);
|
||||
const sitemapPath = resolve(distPath, 'sitemap.xml');
|
||||
writeFileSync(sitemapPath, sitemapContent);
|
||||
|
||||
|
||||
Reference in new issue
Block a user