import fs = require("fs-extra"); import path, { resolve } from "path"; import dotenv from "dotenv"; import os from "os"; dotenv.config({ path: resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`), }); const RootDirectory = process.env.MEDIA_PATH!.replace("~", os.homedir); const JobsFolder = "Jobs"; const VendorsFolder = "Vendors"; export const FolderPaths = { Root: RootDirectory, Jobs: path.join(RootDirectory, JobsFolder), Vendors: path.join(RootDirectory, VendorsFolder), ThumbsSubDir: "/thumbs", StaticPath: "/static", JobsFolder, VendorsFolder, }; export default function InitServer() { console.log(`Ensuring Root media path exists: ${FolderPaths.Root}`); fs.ensureDirSync(FolderPaths.Root); console.log(`Ensuring Jobs media path exists: ${FolderPaths.Jobs}`); fs.ensureDirSync(FolderPaths.Jobs); console.log(`Ensuring Vendors media path exists: ${FolderPaths.Vendors}`); fs.ensureDirSync(FolderPaths.Vendors); }