fix: small case change

Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
Andrew Calcutt 2023-10-12 23:23:07 -04:00
parent 979f841464
commit 94eae4910f

View file

@ -66,7 +66,7 @@ const opts = program.opts();
console.log(`Starting ${packageJson.name} v${packageJson.version}`); console.log(`Starting ${packageJson.name} v${packageJson.version}`);
const startServer = (configPath, config) => { const StartServer = (configPath, config) => {
let publicUrl = opts.public_url; let publicUrl = opts.public_url;
if (publicUrl && publicUrl.lastIndexOf('/') !== publicUrl.length - 1) { if (publicUrl && publicUrl.lastIndexOf('/') !== publicUrl.length - 1) {
publicUrl += '/'; publicUrl += '/';
@ -85,7 +85,7 @@ const startServer = (configPath, config) => {
}); });
}; };
const startWithinputFile = async (inputFile) => { const StartWithInputFile = async (inputFile) => {
console.log(`[INFO] Automatically creating config file for ${inputFile}`); console.log(`[INFO] Automatically creating config file for ${inputFile}`);
console.log(`[INFO] Only a basic preview style will be used.`); console.log(`[INFO] Only a basic preview style will be used.`);
console.log( console.log(
@ -182,7 +182,7 @@ const startWithinputFile = async (inputFile) => {
console.log('Run with --verbose to see the config file here.'); console.log('Run with --verbose to see the config file here.');
} }
return startServer(null, config); return StartServer(null, config);
} else { } else {
if (isValidHttpUrl(inputFile)) { if (isValidHttpUrl(inputFile)) {
console.log(`ERROR: MBTiles does not support web based files: `); console.log(`ERROR: MBTiles does not support web based files: `);
@ -241,7 +241,7 @@ const startWithinputFile = async (inputFile) => {
console.log('Run with --verbose to see the config file here.'); console.log('Run with --verbose to see the config file here.');
} }
return startServer(null, config); return StartServer(null, config);
}); });
}); });
} }
@ -257,7 +257,7 @@ fs.stat(path.resolve(opts.config), (err, stats) => {
} }
if (inputFile) { if (inputFile) {
return startWithinputFile(inputFile); return StartWithInputFile(inputFile);
} else { } else {
// try to find in the cwd // try to find in the cwd
const files = fs.readdirSync(process.cwd()); const files = fs.readdirSync(process.cwd());
@ -272,7 +272,7 @@ fs.stat(path.resolve(opts.config), (err, stats) => {
} }
if (inputFile) { if (inputFile) {
console.log(`No input file specified, using ${inputFile}`); console.log(`No input file specified, using ${inputFile}`);
return startWithinputFile(inputFile); return StartWithInputFile(inputFile);
} else { } else {
const url = const url =
'https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/zurich_switzerland.mbtiles'; 'https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/zurich_switzerland.mbtiles';
@ -280,12 +280,12 @@ fs.stat(path.resolve(opts.config), (err, stats) => {
const stream = fs.createWriteStream(filename); const stream = fs.createWriteStream(filename);
console.log(`No input file found`); console.log(`No input file found`);
console.log(`[DEMO] Downloading sample data (${filename}) from ${url}`); console.log(`[DEMO] Downloading sample data (${filename}) from ${url}`);
stream.on('finish', () => startWithinputFile(filename)); stream.on('finish', () => StartWithInputFile(filename));
return request.get(url).pipe(stream); return request.get(url).pipe(stream);
} }
} }
} else { } else {
console.log(`Using specified config file from ${opts.config}`); console.log(`Using specified config file from ${opts.config}`);
return startServer(opts.config, null); return StartServer(opts.config, null);
} }
}); });