Dumb hardcoding
This commit is contained in:
parent
d575fd58e2
commit
81daaa174a
@ -5,7 +5,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- ./images:/app/images
|
- ./images:/app/images
|
||||||
- ./images.json:/app/images.json
|
- /var/core/analogGallery/images.json:/app/images.json
|
||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@ -7,6 +7,10 @@ import { fileURLToPath } from 'url';
|
|||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
async function generateSite() {
|
async function generateSite() {
|
||||||
|
try {
|
||||||
|
// Check if images.json exists before trying to read it
|
||||||
|
await fs.access('images.json', fs.constants.F_OK);
|
||||||
|
|
||||||
// Read the images data
|
// Read the images data
|
||||||
const imagesData = JSON.parse(
|
const imagesData = JSON.parse(
|
||||||
await fs.readFile('images.json', 'utf-8')
|
await fs.readFile('images.json', 'utf-8')
|
||||||
@ -116,6 +120,14 @@ async function generateSite() {
|
|||||||
await fs.writeFile('public/index.html', indexHtml);
|
await fs.writeFile('public/index.html', indexHtml);
|
||||||
|
|
||||||
console.log('Site generated successfully!');
|
console.log('Site generated successfully!');
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === 'ENOENT') {
|
||||||
|
console.error('images.json does not exist. Please run fetchImages.js first.');
|
||||||
|
} else {
|
||||||
|
console.error('Error generating site:', error);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function serveStaticSite(port = 3000) {
|
async function serveStaticSite(port = 3000) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user