summary refs log tree commit diff
path: root/src/start.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/start.ts')
-rw-r--r--src/start.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/start.ts b/src/start.ts
new file mode 100644

index 00000000..72175f46 --- /dev/null +++ b/src/start.ts
@@ -0,0 +1,17 @@ +import { CDNServer } from "./Server"; +import dotenv from "dotenv"; +dotenv.config(); + +if (process.env.STORAGE_LOCATION) { + if (!process.env.STORAGE_LOCATION.startsWith("/")) { + process.env.STORAGE_LOCATION = __dirname + "/../" + process.env.STORAGE_LOCATION; + } +} else process.env.STORAGE_LOCATION = __dirname + "/../files/"; + +const server = new CDNServer({ port: Number(process.env.PORT) || 3003 }); +server + .start() + .then(() => { + console.log("[Server] started on :" + server.options.port); + }) + .catch((e) => console.error("[Server] Error starting: ", e));