if I switch NODE_ENVs and want to use a different database like mydb_production, obviously TypeORM complains

Question: I'm setting up a Docker project with TypeORM and have dev & production modes, and I'm using the official postgres:alpine image for db. Everything is fine when the app first launches bc postgres runs initdb with mydb_development database name I pass in. However, if I switch NODE_ENVs and want to use a different database like mydb_production, obviously TypeORM complains because that database doesn't exist and postgres won't auto create it because the initdb script already ran the first time. I'm not sure the best way to solve this.
Is this something that you think should be handled on the typeorm service, or should I delegate this to the postgres service somehow?
You already invited:

Bobby

Upvotes from:

but why you try use production name for db on dev Docker?

If you wanna answer this question please Login or Register