Docker compose: environmental variables for database connection

Is it possible to use environmental variables specified in the docker compose file within shiny app to set up database variables inside dbConnect?
Use case: No need hardcode connection into the app. Easier for debugging.