Dumb hardcoding
This commit is contained in:
parent
d575fd58e2
commit
81daaa174a
@ -5,7 +5,7 @@ services:
|
||||
build: .
|
||||
volumes:
|
||||
- ./images:/app/images
|
||||
- ./images.json:/app/images.json
|
||||
- /var/core/analogGallery/images.json:/app/images.json
|
||||
expose:
|
||||
- "3000"
|
||||
environment:
|
||||
|
||||
@ -7,6 +7,10 @@ import { fileURLToPath } from 'url';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
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
|
||||
const imagesData = JSON.parse(
|
||||
await fs.readFile('images.json', 'utf-8')
|
||||
@ -116,6 +120,14 @@ async function generateSite() {
|
||||
await fs.writeFile('public/index.html', indexHtml);
|
||||
|
||||
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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user