wip fix
This commit is contained in:
parent
f1180c2966
commit
b6badb3cec
|
|
@ -30,9 +30,7 @@ if (!g.Y) {
|
|||
await createLogger();
|
||||
g._api = {};
|
||||
g.mode = process.argv.includes("dev") ? "dev" : "prod";
|
||||
g.datadir = dir.path(g.mode == "prod" ? "../data" : "data");
|
||||
console.log(`DataDir: ${g.datadir}`);
|
||||
|
||||
g.datadir = dir.path(g.mode === "prod" ? "../data" : "data", false);
|
||||
g.port = parseInt(process.env.PORT || "4550");
|
||||
|
||||
g.log.info(g.mode === "dev" ? "DEVELOPMENT" : "PRODUCTION");
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
import { join } from "path";
|
||||
|
||||
export const dir = {
|
||||
path: (path: string) => {
|
||||
const final_path = path.split("/").filter((e) => e !== "..").join('/');
|
||||
path: (path: string, safe?: boolean) => {
|
||||
if (safe === false) return join(process.cwd(), path);
|
||||
const final_path = path
|
||||
.split("/")
|
||||
.filter((e) => e !== "..")
|
||||
.join("/");
|
||||
return join(process.cwd(), final_path);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue