spring-cloud-config-client
A helper library written in Python to fetch configuration properties from the Spring Cloud Config server.
Development Setup
To contribute to this project, you’ll need to install some common prerequisites first, and then follow setup instructions.
Prerequisites
Setup
# Install Python 3.12 and all dependencies under ./venv locally
make install-dev
How to Use
Fetch configuration the same way you would in a Spring Boot application. Below is a realistic client that pulls database, Kafka, and actuator settings exposed by a Spring Cloud Config Server:
from spring_cloud_config_client import props
# Initialize with your Spring application name and active profiles
props.init("inventory-service", ["prod", "us-east-1"])
# Common Spring properties
db_url = props.get("spring.datasource.url")
db_user = props.get("spring.datasource.username")
db_password = props.get("spring.datasource.password")
connection_timeout = props.get(
"spring.datasource.hikari.connection-timeout",
default_value=30_000,
)
# Messaging and observability
kafka_servers = props.get("spring.kafka.bootstrap-servers")
order_topic = props.get("spring.kafka.topic.orders")
actuator_exposed = props.get(
"management.endpoints.web.exposure.include",
default_value="health,info,prometheus",
)
# You can also fetch structured sections
logging_levels = props.get("logging.level")
# {'root': 'INFO', 'com.example.inventory': 'DEBUG'}
The library can also make use of environment variables. So if your configuration property contains a placeholder (e.g. ${REDIS_HOST} or ${KAFKA_HOST:localhost} etc.) it will be replaced by its matching environment variable (REDIS_HOST, KAFKA_HOST etc.) if exists.
If the environment variable cannot be found, it searches for an optional default value in the placeholder (e.g. localhost in \${KAFKA_HOST:localhost}) and if this is also not found, it throws an exception. Only alphanumeric characters and dash (-) are supported for default values.
Environment Variables
Configure the client with these environment variables:
- CONFIG_SERVER_FQDN overrides host and port with a full URL (default
http://localhost:8080/) - CONFIG_SERVER_HOST host used when
CONFIG_SERVER_FQDNis unset (defaultlocalhost) - CONFIG_SERVER_PORT port paired with
CONFIG_SERVER_HOST(default8080) - CONFIG_SERVER_USERNAME HTTP basic auth username (default
user) - CONFIG_SERVER_PASSWORD HTTP basic auth password (default empty)
- CONFIG_CLIENT_FAIL_FAST exits when unable to reach the config server if set to
True(defaultFalse) - CONFIG_CLIENT_RETRY_INITIAL_INTERVAL wait (seconds) before the first retry (default
1) - CONFIG_CLIENT_RETRY_MAX_INTERVAL maximum wait (seconds) between retries (default
10) - CONFIG_CLIENT_RETRY_MAX_ATTEMPTS total attempts before giving up (default
5) - CONFIG_CLIENT_RETRY_MULTIPLIER exponential backoff multiplier applied between retries (default
1.1)
Unit Tests
make test
Integration Tests
If you have Docker available, you can run a live integration test suite against an actual Spring Cloud Config Server:
make test-integration
The target spins up the server defined in docker-compose.integration.yml, serves the fixtures from tests/integration/config-repo, runs the tests in tests/integration, and tears everything down when finished.
Versioning
We use semantic versioning. You can check here when and how to bump up the version.
make set-version VERSION=<NEW_VERSION>`
Release files for spring-cloud-config-client 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spring_cloud_config_client-0.4.0.tar.gz | 30.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spring_cloud_config_client-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:37.0 kB
Release files / spring_cloud_config_client-0.4.0.tar.gz
| Download URL | spring_cloud_config_client-0.4.0.tar.gz |
|---|---|
| Size | 30.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4c54a64c2cf902a91880ce9c925677df9390b0847f8a2290c7a54556e091bf7
|
|
BLAKE2b-256 checksum How to use checksums |
40a45a8ecce9a45af0631c89e7f2b02be6ecd9bb6fd3115312af19d7200e8694
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.
Transparency logRelease files / spring_cloud_config_client-0.4.0-py3-none-any.whl
| Download URL | spring_cloud_config_client-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69917633722289849319758c7a492b6e84f45764f50e446d0a4f15ea17e79931
|
|
BLAKE2b-256 checksum How to use checksums |
c80364e4d9e56bafbd145b523e94f7274b10347cfa53e6cfdde29cf42e929197
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.
Transparency log