pas2js: httpcompiler: fixed reading values fomr config file

This commit is contained in:
mattias 2021-09-09 16:09:52 +02:00
parent 61cf121533
commit bad14c5dbd

View File

@ -705,11 +705,14 @@ Var
begin begin
Result:=False; Result:=False;
FAPI:=GetOptionValue('A','api'); if HasOption('A','api') then
FServeOnly:=HasOption('s','serve-only'); FAPI:=GetOptionValue('A','api');
Quiet:=HasOption('q','quiet'); FServeOnly:=FServeOnly or HasOption('s','serve-only');
Port:=StrToIntDef(GetOptionValue('p','port'),3000); Quiet:=Quiet or HasOption('q','quiet');
D:=GetOptionValue('d','directory'); if (Port=0) or HasOption('p','port') then
Port:=StrToIntDef(GetOptionValue('p','port'),3000);
if HasOption('d','directory') then
D:=GetOptionValue('d','directory');
if D='' then if D='' then
D:=GetCurrentDir; D:=GetCurrentDir;
if HasOption('m','mimetypes') then if HasOption('m','mimetypes') then
@ -734,9 +737,11 @@ begin
Log(etInfo,'Listening on port %d, serving files from directory: %s',[Port,D]); Log(etInfo,'Listening on port %d, serving files from directory: %s',[Port,D]);
if ServeOnly then if ServeOnly then
Log(etInfo,'Compile requests will be ignored.'); Log(etInfo,'Compile requests will be ignored.');
If not HasOption('n','noindexpage') then NoIndexPage:=NoIndexPage or HasOption('n','noindexpage');
begin if HasOption('i','indexpage') then
IndexPage:=GetOptionValue('i','indexpage'); IndexPage:=GetOptionValue('i','indexpage');
If not NoIndexPage then
begin
if (IndexPage='') then if (IndexPage='') then
IndexPage:='index.html'; IndexPage:='index.html';
Log(etInfo,'Using index page %s',[IndexPage]); Log(etInfo,'Using index page %s',[IndexPage]);