Skip to content

Commit

Permalink
use local json as fallback for metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
lambley committed Aug 8, 2024
1 parent e386030 commit 1b793d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Thumbs.db
# Uploads
**/uploads/

# JSON data
**/dataStore-filesData.json

## CLIENT

# testing
Expand Down
2 changes: 1 addition & 1 deletion server/src/filesData.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"name": "Presentation3",
"key": "presentation3.pptx"
}
]
]
4 changes: 3 additions & 1 deletion server/src/utils/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import fs from 'fs';
import path from 'path';
import { FileMetadata } from '../../types/files';

const filesDataPath = path.join(__dirname, '../filesData.json');
const jsonFileName = process.env.DATA_STORE_JSON || 'filesData';

const filesDataPath = path.join(__dirname, `../${jsonFileName}.json`);

const loadFilesData = (): FileMetadata[] => {
if (fs.existsSync(filesDataPath)) {
Expand Down

0 comments on commit 1b793d0

Please sign in to comment.