0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-30 02:31:08 +00:00

feat: Use differente connection strings for different envs

This commit is contained in:
Alexander Konietzko 2023-09-15 13:40:06 +02:00
parent 56be506f0c
commit fe99c83975
No known key found for this signature in database
GPG Key ID: BA6905F37AEC2B5B
3 changed files with 10 additions and 7 deletions

View File

@ -57,15 +57,13 @@ Running the container
### Using docker-compose
1. Change the ConnectionString in the appsettings.json to `Server=db;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#`
2. Build the Dockerfile: `docker build -t clean-architecture .`
3. Running the docker compose: `docker-compose up -d` (Delete: `docker-compose down`)
1. Build the Dockerfile: `docker build -t clean-architecture .`
2. Running the docker compose: `docker-compose up -d` (Delete: `docker-compose down`)
### Using Kubernetes
1. Change the ConnectionString in the appsettings.json to `Server=sql-server;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#`
2. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own)
Apply the deployment file: `kubectl apply -f k8s-deployment.yml` (Delete: `kubectl delete -f k8s-deployment.yml`)
1. Build the docker image and push it to the docker hub (Change the image name in the `k8s-deployment.yml` to your own)
2. Apply the deployment file: `kubectl apply -f k8s-deployment.yml` (Delete: `kubectl delete -f k8s-deployment.yml`)
## Running the Tests

View File

@ -13,6 +13,8 @@ services:
condition: service_healthy
links:
- db
environment:
- ConnectionStrings__DefaultConnection=Server=db;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost/healthz"]
interval: 30s

View File

@ -31,4 +31,7 @@ spec:
# Replace this with the path to your built image
image: alexdev28/clean-architecture:latest
ports:
- containerPort: 80
- containerPort: 80
env:
- name: ConnectionStrings__DefaultConnection
value: Server=sql-server;Database=clean-architecture;Trusted_Connection=False;MultipleActiveResultSets=true;TrustServerCertificate=True;User Id=SA;Password=Password123!#