# added userSecret to store .. secrets

This commit is contained in:
Dominic Villemure
2024-04-21 11:07:34 -04:00
parent 5a23b945cd
commit a0a6e7deb4
4 changed files with 23 additions and 10 deletions

View File

@@ -4,7 +4,6 @@
- Clean Architecture ( with Infrastructure, Domain, Application and Web layers )
- Minimal API endpoints.
- Guards ( Fail fast ) : https://github.com/ardalis/GuardClauses
-
## Tools
- Install Docker : https://www.docker.com/get-started/
@@ -20,8 +19,6 @@ Or with a mounted volume to persist data on the computer instead ( persist data
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourPassword>' -p 1433:1433 -v C:\dev\DockerVolumes\SqlServer-Utopy-1\data:/var/opt/mssql/data -v C:\dev\DockerVolumes\SqlServer-Utopy-1\log:/var/opt/mssql/log -v C:\dev\DockerVolumes\SqlServer-Utopy-1\secrets:/var/opt/mssql/secrets -d mcr.microsoft.com/mssql/server:2022-latest
```
Set your password in an env var for the connection string. Windows : $Env:DB_PASSWORD = "YourPassword"
## Entity Framework
Create a new migration :
@@ -34,6 +31,24 @@ Update database :
./Ef.ps1 database update
```
## Secret Manager tool
Go to Web project: cd src/Web
Add a user secret for local development :
```
dotnet user-secrets set "DB_PASSWORD" "12345"
```
list your stored secrets :
```
dotnet user-secrets list
```
Delete a secret :
```
dotnet user-secrets remove "DB_PASSWORD"
```
## Build
Run `dotnet build -tl` to build the solution.