-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] Config and docker-compose #11
Comments
I'm closing it, it's not related to Nest, but TypeORM :-) |
@otroboe Take a look at using a .env file for config. It has some limitations with typeorm if you want to use more than one database but it should get the job done in most cases Docker Compose Environment Vars & Typeorm If you couple with something like Direnv to parse the .env file when you enter the directory it should work out pretty good.
version: '3.1'
services:
pgsql:
image: postgres:9
ports:
- ${TYPEORM_PORT}:5432
environment:
POSTGRES_PASSWORD: ${TYPEORM_PASSWORD}
POSTGRES_DB: ${TYPEORM_DATABASE}
volumes:
- pg_data:/var/lib/postgres/data
volumes:
pg_data: |
Thank you ! I'll test your solution as soon as I can. |
@otroboe another cool thing you can do with direnv is create shell scripts for a specific project and modify the path for the current working directory. This works like a charm with typeorm, i got annoyed having to invoke ts-node everytime i wanted to create or run migrations. #!/bin/bash
#/path/to/program/bin/typeorm
./node_modules/.bin/ts-node ./node_modules/.bin/typeorm $1 $2 $3 $4 $5 |
@jcloutz you can also load the .env file within docker-compose using
|
You don't need to do that with docker-compose, it loads the |
@otroboe That's convenient! I guess in my habit of being explicit with Docker, that nuance got lost on me. |
You can still use the |
Hey guys !
I'm using docker-compose for my mysql server, but I'm quite annoyed by having connection configuration in two different places:
docker-compose.yml
ormconfig.json
Would you have some ideas how to keep the connection in only one place ?
The text was updated successfully, but these errors were encountered: