Skip to content
Ameen Abozaid
Planned lessonJNR-052-L03

Configuration in deployed environments

  • Lesson 3 of 7
  • Junior
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_URL maps to spring.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

bash
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.0

Check 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.