Early work on prod container
This commit is contained in:
parent
17fa857609
commit
91f54424ed
8 changed files with 132 additions and 9 deletions
|
@ -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