Configuration in deployed environments
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
configure the app without rebuilding it.
Planned topics
- Spring Boot reads environment variables:
SPRING_DATASOURCE_URLmaps tospring.datasource.url. - Put database credentials and keys in the platform's secret store, never in the image or Git.
- Use profiles (
SPRING_PROFILES_ACTIVE=prod) for non-secret differences. - Config that changes per environment is passed at run time.
- Log which profile is active at startup, but not any secret values.
Draft outline details
Demonstration
docker run -d -p 8080:8080 \
-e SPRING_PROFILES_ACTIVE=prod \
-e SPRING_DATASOURCE_URL=jdbc:postgresql://db.example.internal:5432/shop \
-e SPRING_DATASOURCE_PASSWORD="$DB_PASSWORD" shop:1.0Check your understanding
Where do database passwords belong?
Show answer
In the platform's secret store, passed as environment variables, never in the image.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.