Make types more logical

This commit is contained in:
Jake Howard 2017-02-17 20:27:30 +00:00
parent fcbe06feb3
commit 2c401c1535
3 changed files with 3 additions and 4 deletions

View file

@ -13,7 +13,7 @@ function getArgs() : Options {
}); });
return { return {
allowed_ips: rawArgs['--ips'] ? rawArgs['--ips'].split(',') : [], allowed_ips: rawArgs['--ips'] ? rawArgs['--ips'].split(',') : [],
basicAuth: rawArgs['--basic-auth'] || '', basicAuth: rawArgs['--basic-auth'] ? rawArgs['--basic-auth'].split(':') : [],
dirList: rawArgs['--list-dir'], dirList: rawArgs['--list-dir'],
serveDir: rawArgs['<dir>'], serveDir: rawArgs['<dir>'],
opbeat: rawArgs['--opbeat'] opbeat: rawArgs['--opbeat']

View file

@ -30,8 +30,7 @@ export default function createServer(opts : Options) : Application {
} }
if (opts.basicAuth) { if (opts.basicAuth) {
const credentials = opts.basicAuth.split(':'); app.use(basicAuthHandler(opts.basicAuth[0], opts.basicAuth[1]));
app.use(basicAuthHandler(credentials[0], credentials[1]));
} }
if (opts.dirList) { if (opts.dirList) {

View file

@ -1,7 +1,7 @@
export interface Options { export interface Options {
allowed_ips: string[]; allowed_ips: string[];
basicAuth: string; basicAuth: string[];
dirList: boolean; dirList: boolean;
serveDir: string; serveDir: string;
opbeat: boolean; opbeat: boolean;