Merge remote-tracking branch 'klokantech/master' into public_url

# Conflicts:
#	src/main.js
#	src/server.js
This commit is contained in:
Alban Mouton
2018-12-19 09:53:40 +01:00
22 changed files with 1297 additions and 554 deletions

View File

@@ -10,51 +10,55 @@ var mbtiles = require('@mapbox/mbtiles');
var packageJson = require('../package');
var opts = require('nomnom')
.option('mbtiles', {
default: undefined,
help: 'MBTiles file (uses demo configuration);\n' +
'\t ignored if the configuration file is also specified',
position: 0
})
.option('config', {
abbr: 'c',
default: 'config.json',
help: 'Configuration file'
})
.option('bind', {
abbr: 'b',
default: undefined,
help: 'Bind address'
})
.option('port', {
abbr: 'p',
default: 8080,
help: 'Port'
})
.option('cors', {
default: true,
help: 'Enable Cross-origin resource sharing headers'
})
.option('public_url', {
abbr: 'u',
default: '',
help: 'Enable exposing the server on subpaths, not necessarily the root of the domain'
})
.option('verbose', {
abbr: 'V',
flag: true,
help: 'More verbose output'
})
.option('version', {
abbr: 'v',
flag: true,
help: 'Version info',
callback: function() {
return packageJson.name + ' v' + packageJson.version;
}
}).parse();
var args = process.argv;
if (args.length >= 3 && args[2][0] != '-') {
args.splice(2, 0, '--mbtiles');
}
var opts = require('commander')
.description('tileserver-gl startup options')
.usage('tileserver-gl [mbtiles] [options]')
.option(
'--mbtiles <file>',
'MBTiles file (uses demo configuration);\n' +
'\t ignored if the configuration file is also specified'
)
.option(
'-c, --config <file>',
'Configuration file [config.json]',
'config.json'
)
.option(
'-b, --bind <address>',
'Bind address'
)
.option(
'-p, --port <port>',
'Port [8080]',
8080,
parseInt
)
.option(
'-C|--no-cors',
'Disable Cross-origin resource sharing headers'
)
.option(
'-u|--public_url',
'Enable exposing the server on subpaths, not necessarily the root of the domain'
)
.option(
'-V, --verbose',
'More verbose output'
)
.option(
'-s, --silent',
'Less verbose output'
)
.version(
packageJson.version,
'-v, --version'
)
.parse(args);
console.log('Starting ' + packageJson.name + ' v' + packageJson.version);
@@ -69,6 +73,7 @@ var startServer = function(configPath, config) {
bind: opts.bind,
port: opts.port,
cors: opts.cors,
silent: opts.silent,
publicUrl: publicUrl
});
};