1+ import { execSync } from "node:child_process" ;
12import fs from "node:fs" ;
23import { createServer } from "node:http" ;
34import type { Socket } from "node:net" ;
45import path from "node:path" ;
5- import { execSync } from "node:child_process" ;
66import fastifyMiddie from "@fastify/middie" ;
77import fastifyStatic from "@fastify/static" ;
8- // @ts -expect-error shut
8+ // @ts -expect-error
99import { server as wisp } from "@mercuryworkshop/wisp-js/server" ;
1010import { build } from "astro" ;
1111import Fastify from "fastify" ;
12- import inConfig from "./config" ;
12+ import INConfig from "./config" ;
1313
1414const RenamedFiles : { [ key : string ] : string } = { } ;
1515
@@ -95,12 +95,13 @@ async function Start() {
9595
9696 if ( FirstRun ) {
9797 console . log ( "Restarting Server..." ) ;
98- execSync ( "pnpm disable && pnpm start" , { stdio : "inherit" } ) ;
98+ execSync ( "pnpm disable && pnpm start" , { stdio : "inherit" } ) ;
9999 process . exit ( 0 ) ;
100100 }
101101 }
102102
103- const port = Number . parseInt ( process . env . PORT as string ) || inConfig . port || 8080 ;
103+ const port = INConfig . port || 8080 ;
104+
104105 const app = Fastify ( {
105106 serverFactory : ( handler ) =>
106107 createServer ( handler ) . on ( "upgrade" , ( req , socket : Socket , head ) =>
@@ -114,11 +115,11 @@ async function Start() {
114115 encodings : [ "br" , "gzip" , "deflate" ] ,
115116 } ) ;
116117
117- if ( inConfig . auth ?. challenge ) {
118+ if ( INConfig . auth ?. challenge ) {
118119 await app . register ( import ( "@fastify/basic-auth" ) , {
119120 authenticate : true ,
120121 validate ( username , password , _req , _reply , done ) {
121- for ( const [ user , pass ] of Object . entries ( inConfig . auth ?. users || { } ) ) {
122+ for ( const [ user , pass ] of Object . entries ( INConfig . auth ?. users || { } ) ) {
122123 if ( username === user && password === pass ) {
123124 return done ( ) ;
124125 }
0 commit comments