Skip to content

Commit

Permalink
Fix errors before release!!
Browse files Browse the repository at this point in the history
Signed-off-by: Reece Dunham <me@rdil.rocks>
  • Loading branch information
RDIL committed Mar 11, 2021
1 parent c503237 commit 9cc00f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 10 additions & 7 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,26 @@ program
)
.option("--no-render-markdown", "don't render markdown files as HTML")

program.parse(process.argv)
const opts = program.parse(process.argv).opts()

/**
* The port that the server will run on.
*/
const port: number = Number.parseInt(program.port)
const port: number = Number.parseInt(opts.port)

if (program.root) {
root = program.root
if (opts.root) {
root = opts.root
}
if (program.noRenderMarkdown) {

if (opts.noRenderMarkdown) {
renderMarkdown = false
}
if (program.enhancedSecurity) {

if (opts.enhancedSecurity) {
enhancedSecurity = true
}
if (program.noRequestLogging) {

if (opts.noRequestLogging) {
logRequests = false
}

Expand Down
7 changes: 6 additions & 1 deletion source/serverHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ const handle = (
// last ditch attempt to make sure this isn't just a case where its something like about-us.html
// being used like /about-us in the browser, which is fairly common now
if (existsSync(`${filePath}.html`)) {
return handleRealFile(response, "html", enhancedSecurity, `${filePath}.html`)
return handleRealFile(
response,
"html",
enhancedSecurity,
`${filePath}.html`
)
}

response.statusCode = err.code === "ENOENT" ? 404 : 500
Expand Down

0 comments on commit 9cc00f1

Please sign in to comment.