mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
Early work on prod container
This commit is contained in:
parent
17fa857609
commit
91f54424ed
8 changed files with 132 additions and 9 deletions
|
@ -14,9 +14,9 @@
|
|||
"start-api-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
||||
"watch-api": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-api-dev\"",
|
||||
"typeorm": "node -r ./register-tsconfig-paths.js ./node_modules/typeorm/cli.js",
|
||||
"migrate-prod": "npm run typeorm -- migration:run",
|
||||
"migrate-prod": "cross-env NODE_ENV=production npm run typeorm -- migration:run",
|
||||
"migrate-dev": "npm run build && npm run typeorm -- migration:run",
|
||||
"migrate-rollback-prod": "npm run typeorm -- migration:revert",
|
||||
"migrate-rollback-prod": "cross-env NODE_ENV=production npm run typeorm -- migration:revert",
|
||||
"migrate-rollback-dev": "npm run build && npm run typeorm -- migration:revert",
|
||||
"test": "npm run build && npm run run-tests",
|
||||
"run-tests": "ava",
|
||||
|
|
|
@ -20,6 +20,7 @@ const envType = z.object({
|
|||
PHISHERMAN_API_KEY: z.string().optional(),
|
||||
|
||||
DOCKER_DEV_MYSQL_PASSWORD: z.string().optional(), // Included here for the DB_PASSWORD default in development
|
||||
DOCKER_PROD_MYSQL_PASSWORD: z.string().optional(), // Included here for the DB_PASSWORD default in production
|
||||
|
||||
DB_HOST: z.string().optional().default("mysql"),
|
||||
DB_PORT: z
|
||||
|
@ -40,6 +41,10 @@ if (fs.existsSync(envPath)) {
|
|||
|
||||
export const env = envType.parse(toValidate);
|
||||
|
||||
if (env.DOCKER_DEV_MYSQL_PASSWORD && !env.DB_PASSWORD) {
|
||||
env.DB_PASSWORD = env.DOCKER_DEV_MYSQL_PASSWORD;
|
||||
if (!env.DB_PASSWORD) {
|
||||
if (process.env.NODE_ENV === "production" && env.DOCKER_PROD_MYSQL_PASSWORD) {
|
||||
env.DB_PASSWORD = env.DOCKER_PROD_MYSQL_PASSWORD;
|
||||
} else if (env.DOCKER_DEV_MYSQL_PASSWORD) {
|
||||
env.DB_PASSWORD = env.DOCKER_DEV_MYSQL_PASSWORD;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue