Skip to content

Commit

Permalink
Fix tileserver root config scan
Browse files Browse the repository at this point in the history
  • Loading branch information
docuracy committed Dec 24, 2024
1 parent 1f626b4 commit 0bea420
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tileserver/repository/reconfiguration/merge-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fileExists = (filePath) => {
};

// Function to recursively scan a directory and process all its subdirectories
const scanDirectory = (dir, configData) => {
const scanDirectory = (dir, configData, isRoot = true) => {
if (fileExists(dir)) {
const files = fs.readdirSync(dir);
files.forEach((file) => {
Expand All @@ -30,8 +30,8 @@ const scanDirectory = (dir, configData) => {

if (stat.isDirectory()) {
// If the file is a directory, recurse into it
scanDirectory(filePath, configData);
} else if (file.endsWith('.mbtiles')) {
scanDirectory(filePath, configData, false);
} else if (file.endsWith('.mbtiles') && !isRoot) {
// If the file is a .mbtiles file, check if it exists in config
const key = path.basename(file, '.mbtiles'); // Use the file name as the key
if (!configData[key]) { // If the tileset is not already in config.json
Expand Down

0 comments on commit 0bea420

Please sign in to comment.