Repository navigation
Show the resilience settings in appsettings.json, Compose/.env and the ConfigMap - #82
Merged
Merged
Conversation
…e ConfigMap The Resilience:Postgres and Resilience:Consumers settings added in #80 only existed as defaults inside the code, so nobody could see or change them without reading the source. They are now written out where an operator looks: * Every service's appsettings.json has the Resilience:Postgres section (Identity, Product, Order, Inventory, Payment); Order, Inventory and Payment, which consume messages, also have Resilience:Consumers. The values are the code's defaults, so behaviour does not change. * docker-compose.yml passes the same keys as environment variables through two YAML anchors (x-resilience-postgres, x-resilience-consumers) merged into the services that use them, each as "${RESILIENCE_...:-default}". An override goes into .env; .env.example lists every variable, commented out, with its default. * k8s/configmaps/configmap.yaml (shopeasy-config, loaded by every Deployment) has the same keys; changing one needs a rollout restart because environment variables are read at pod start. Normal ASP.NET Core precedence applies: environment variable, then appsettings.json, then the default in the code. Several copies of a default can drift, so ResilienceConfigurationTests (15 tests, no servers needed) fails when any appsettings.json, the Compose file, the ConfigMap or .env.example differs from the code's defaults (checked by changing a value in three of them), when a service with a database or consumers does not get its settings, and it checks with the real Order appsettings.json that the file is read by the services and that an override wins. Verified: docker compose config renders the defaults and an override from .env for the right services (gateway gets none); kustomize + kubeconform -strict and the repository's deployment rules pass; the whole suite is green (280 tests, 234 without servers, 46 with PostgreSQL and RabbitMQ). The README documents where the settings live and how to change them, and its test counts are updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vuhzoey6h5V9wPPVFuR7ME
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
Resilience:PostgresandResilience:Consumerssettings from #80 only existed as defaults inside the code, so nobody could see or change them without reading the source. This writes them out where an operator looks. Behaviour does not change: the values are the code's defaults.What
appsettings.jsonof every service:Resilience:Postgresin Identity, Product, Order, Inventory and Payment.Resilience:Consumersin Order, Inventory and Payment, which consume messages.docker-compose.yml: the same keys as environment variables through two YAML anchors (x-resilience-postgres,x-resilience-consumers) merged into the services that use them. Each is${RESILIENCE_…:-default}. The gateway has no database or consumers and gets none..env.example: everyRESILIENCE_*variable, commented out, with its default. To override one, uncomment it in.env.shopeasy-configConfigMap: the same keys. Changing one needs akubectl rollout restartbecause environment variables are read at pod start.appsettings.json, then the code default. Test counts updated.Keeping the copies honest
ResilienceConfigurationTests(15 tests, no servers needed) fails when anyappsettings.json, the Compose file, the ConfigMap or.env.examplediffers from the code's defaults. It also fails when a service that should get the settings does not. One test reads the real Orderappsettings.jsonand checks that an override wins. I confirmed they catch drift by changing a value in three of the files.Verified
docker compose configrenders the defaults, and an override from.envreaches the five right services (and not the gateway).kustomize build+kubeconform -strictand the repo's deployment rules pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vuhzoey6h5V9wPPVFuR7ME
Generated by Claude Code