Make types more logical
This commit is contained in:
parent
fcbe06feb3
commit
2c401c1535
3 changed files with 3 additions and 4 deletions
|
@ -13,7 +13,7 @@ function getArgs() : Options {
|
|||
});
|
||||
return {
|
||||
allowed_ips: rawArgs['--ips'] ? rawArgs['--ips'].split(',') : [],
|
||||
basicAuth: rawArgs['--basic-auth'] || '',
|
||||
basicAuth: rawArgs['--basic-auth'] ? rawArgs['--basic-auth'].split(':') : [],
|
||||
dirList: rawArgs['--list-dir'],
|
||||
serveDir: rawArgs['<dir>'],
|
||||
opbeat: rawArgs['--opbeat']
|
||||
|
|
|
@ -30,8 +30,7 @@ export default function createServer(opts : Options) : Application {
|
|||
}
|
||||
|
||||
if (opts.basicAuth) {
|
||||
const credentials = opts.basicAuth.split(':');
|
||||
app.use(basicAuthHandler(credentials[0], credentials[1]));
|
||||
app.use(basicAuthHandler(opts.basicAuth[0], opts.basicAuth[1]));
|
||||
}
|
||||
|
||||
if (opts.dirList) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
export interface Options {
|
||||
allowed_ips: string[];
|
||||
basicAuth: string;
|
||||
basicAuth: string[];
|
||||
dirList: boolean;
|
||||
serveDir: string;
|
||||
opbeat: boolean;
|
||||
|
|
Reference in a new issue