This commit is contained in:
Benjamin Toby
2025-03-17 08:48:58 +01:00
parent ec4d0428bb
commit 34f843bc84
20 changed files with 113 additions and 46 deletions
@@ -4,15 +4,19 @@ import path from "path";
type Param = {
user?: DATASQUIREL_LoggedInUser | UserType;
userId?: string | number | null;
appDir?: string;
};
export default function grabDirNames(param?: Param) {
const appDir = process.env.DSQL_APP_DIR;
const schemasDir = process.env.DSQL_DB_SCHEMA_DIR;
const tempDirName = ".tmp";
const appDir = param?.appDir || process.env.DSQL_APP_DIR;
if (!appDir)
throw new Error("Please provide the `DSQL_APP_DIR` env variable.");
const schemasDir =
process.env.DSQL_DB_SCHEMA_DIR ||
path.join(appDir, "jsonData", "dbSchemas");
const tempDirName = ".tmp";
if (!schemasDir)
throw new Error(
"Please provide the `DSQL_DB_SCHEMA_DIR` env variable."
@@ -67,7 +71,14 @@ export default function grabDirNames(param?: Param) {
"docker/mariadb/load-balancer/config/template/nginx.conf"
);
const dockerComposeFile = path.join(appDir, "docker-compose.yml");
const testDockerComposeFile = path.join(appDir, "test.docker-compose.yml");
const siteSetupFile = path.join(appDir, "site-setup.json");
const envFile = path.join(appDir, ".env");
const testEnvFile = path.join(appDir, "test.env");
return {
appDir,
schemasDir,
userDirPath,
mainShemaJSONFilePath,
@@ -86,5 +97,10 @@ export default function grabDirNames(param?: Param) {
userPrivateDbImportZipFileName,
userPrivateDbImportZipFilePath,
dbNginxLoadBalancerConfigFile,
dockerComposeFile,
testDockerComposeFile,
siteSetupFile,
envFile,
testEnvFile,
};
}