Konfiguracja oparta na Git
Wersjonuj konfigurację w repozytorium Git
Konfiguracja oparta na Git to bezpłatna lekcja Spring Boot 4 Microservices & REST APIs na CoddyKit. To lekcja 2 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Spring Boot 4 Microservices & REST APIs, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Spring Boot 4 Microservices & REST APIs zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
Why Git as the backend
Storing configuration in Git gives you version history, code review, and rollback. The Config Server simply reads files from a configured repository.
The config repo layout
Each service has one or more YAML/properties files named after its application name, optionally with a profile suffix.
// config-repo/
// application.yml (shared by all)
// orders.yml (orders, default profile)
// orders-prod.yml (orders, prod profile)
// inventory.ymlShared application.yml
A file literally named application.yml holds defaults applied to every client. Put cross-cutting settings (logging, common URLs) here.
Profile-specific overrides
Profile files like orders-prod.yml override the base orders.yml for that profile. The server merges them, with the profile file taking precedence.
Pointing the server at the repo
Set the Git URI on the server. For private repos add credentials or an SSH key.
spring:
cloud:
config:
server:
git:
uri: https://github.com/acme/config-repo
username: ci-bot
password: ${GIT_TOKEN}Choosing a branch (label)
The Git label defaults to main/master but can be any branch or tag. Clients can request a specific label, enabling per-environment branches.
server:
cloud:
config:
server:
git:
default-label: release-2026Search paths in the repo
If config lives in subfolders, set search-paths so the server looks in the right places. Placeholders like {application} are supported.
spring:
cloud:
config:
server:
git:
uri: https://github.com/acme/config-repo
search-paths: "{application}"Cloning behavior
The server clones the repo on first request (or eagerly). With clone-on-start: true it fails fast at boot if the repo is unreachable, surfacing misconfiguration early.
spring:
cloud:
config:
server:
git:
clone-on-start: truePicking up new commits
On each client request the server checks for new commits. So pushing a change to the repo makes it available - clients still need to be refreshed to apply it (covered later).
Multiple repos
You can map different applications or patterns to different repositories, e.g. keep secrets in a separate, tightly-controlled repo.
spring:
cloud:
config:
server:
git:
uri: https://github.com/acme/general-config
repos:
secure:
pattern: payments-*
uri: https://github.com/acme/secure-configKeeping secrets safe
Even in Git, never commit plaintext secrets. Use the server's {cipher} encryption or an external secret manager, and restrict repo access.
Quick Check
Verify your Git-backend understanding.
Recap
You backed config with Git:
- Files named by application + optional profile suffix
application.yml= shared defaults;app-profile.ymloverrides- Configure URI, label (branch), search-paths and credentials
- Keep secrets encrypted, never plaintext
Często zadawane pytania
Czy lekcja „Konfiguracja oparta na Git” jest bezpłatna?
Tak — pełny tekst „Konfiguracja oparta na Git” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Spring Boot 4 Microservices & REST APIs, przejdź na CoddyKit PRO. Kurs Spring Boot 4 Microservices & REST APIs zawiera 4 lekcji w sumie.
Co nauczysz się w „Konfiguracja oparta na Git”?
Wersjonuj konfigurację w repozytorium Git Ćwiczysz Spring Boot 4 Microservices & REST APIs z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.
Czy potrzebuję doświadczenia, aby zacząć Spring Boot 4 Microservices & REST APIs?
Nie wymagamy żadnego doświadczenia. Spring Boot 4 Microservices & REST APIs w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 2 z 4.
Ile czasu zajmuje lekcja „Konfiguracja oparta na Git”?
Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.
Czy mogę pisać i uruchamiać kod w tej lekcji Spring Boot 4 Microservices & REST APIs?
Tak. Każda lekcja Spring Boot 4 Microservices & REST APIs zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.
Wszystkie lekcje w tym kursie
- Serwer konfiguracji
- Konfiguracja oparta na Git
- Klienci konfiguracji
- Odświeżanie konfiguracji w czasie działania