Postgres service - how to know database url?

Is there an env var set for me to know in my app what the database connection is?

Answer:
DATABASE_URL: postgres://runner@postgres:5432/development
POSTGRES_DB: development
POSTGRES_USER: runner
POSTGRES_PASSWORD: “”

And when you want to execute a SQL script:
before_script:

  • apt-get update -y
  • apt-get install postgresql-client -y
  • export PGPASSWORD=$POSTGRES_PASSWORD
  • psql -h “postgres” -U “$POSTGRES_USER” -d “$POSTGRES_DB” -f sql/schema.sql