diff --git a/src/lib/index.ts b/src/lib/index.ts index b3d4e55..1df0551 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,6 +1,11 @@ // place files you want to import through the `$lib` alias in this folder. const safePath = (input: string) => input.replace(/\W/g, ''); -export const storagePath: string = process.env.STORAGE_PATH; + +const defaultPath: string = './uploads'; +if (!('STORAGE_PATH' in process.env)) { + console.log(`'STORAGE_PATH' environment variable is not set. Defaulting to ${defaultPath}`); +} +export const storagePath: string = process.env.STORAGE_PATH ?? defaultPath; export default safePath;