mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
67b1fe5514
Co-authored-by: Tom Moor <tom.moor@gmail.com>
21 lines
579 B
TypeScript
21 lines
579 B
TypeScript
import { existsSync, mkdirSync } from "fs";
|
|
import env from "@server/env";
|
|
import Logger from "@server/logging/Logger";
|
|
|
|
export const createRootDirForLocalStorage = () => {
|
|
if (env.FILE_STORAGE === "local") {
|
|
const rootDir = env.FILE_STORAGE_LOCAL_ROOT_DIR;
|
|
try {
|
|
if (!existsSync(rootDir)) {
|
|
mkdirSync(rootDir, { recursive: true });
|
|
Logger.debug("utils", `Created ${rootDir} for local storage`);
|
|
}
|
|
} catch (err) {
|
|
Logger.fatal(
|
|
"Couldn't create root dir for local storage of attachments",
|
|
err
|
|
);
|
|
}
|
|
}
|
|
};
|