109
109
| misc | misc scripts ( restore scripts exec permissions, db dia gen script ) |
110
110
| src | sources |
111
111
| src/backend | c# backend |
112
+ | src/backend/abstractions | c# backend abstraction services |
112
113
| src/backend/db-context | c# database context |
113
114
| src/backend/db-migrations-psql | c# ef core psql migrations |
114
115
| src/backend/test | c# backend integration test |
@@ -155,19 +156,55 @@ DB_CONN_STRING="Host=localhost; Database=ExampleWebApp; Username=example_webapp_
155
156
JWTKEY=" $( openssl rand -hex 32) "
156
157
```
157
158
159
+ optionally set unit test conn string
160
+
161
+ ``` sh
162
+ UNIT_TEST_DB_CONN_STRING=" Host=localhost; Database=ExampleWebAppTest; Username=example_webapp_user; Password=$( cat ~ /security/devel/ExampleWebApp/postgres-user) "
163
+ ```
164
+
158
165
- set development user secrets
159
166
160
167
``` sh
161
168
cd src/backend/webapi
162
169
dotnet user-secrets init
163
- dotnet user-secrets set " SeedUsers:Admin:Email" " $SEED_ADMIN_EMAIL "
164
- dotnet user-secrets set " SeedUsers:Admin:Password" " $SEED_ADMIN_PASS "
165
- dotnet user-secrets set " DbProvider" " $DB_PROVIDER "
166
- dotnet user-secrets set " ConnectionStrings:Main" " $DB_CONN_STRING "
167
- dotnet user-secrets set " JwtSettings:Key" " $JWTKEY "
170
+
171
+ dotnet user-secrets set " AppConfig:Auth:Jwt:Key" " $JWTKEY "
172
+
173
+ dotnet user-secrets set " AppConfig:Database:Seed:Users:0:Username" " admin"
174
+ dotnet user-secrets set " AppConfig:Database:Seed:Users:0:Email" " $SEED_ADMIN_EMAIL "
175
+ dotnet user-secrets set " AppConfig:Database:Seed:Users:0:Password" " $SEED_ADMIN_PASS "
176
+ dotnet user-secrets set " AppConfig:Database:Seed:Users:0:Roles:0" " admin"
177
+
178
+ dotnet user-secrets set " AppConfig:Database:ConnectionName" " Development"
179
+ dotnet user-secrets set " AppConfig:Database:Connections:0:Name" " Development"
180
+ dotnet user-secrets set " AppConfig:Database:Connections:0:ConnectionString" " $DB_CONN_STRING "
181
+ dotnet user-secrets set " AppConfig:Database:Connections:0:Provider" " $DB_PROVIDER "
182
+
183
+ # optionally configure also unit test db
184
+ dotnet user-secrets set " AppConfig:Database:Connections:1:Name" " UnitTest"
185
+ dotnet user-secrets set " AppConfig:Database:Connections:1:ConnectionString" " $UNIT_TEST_DB_CONN_STRING "
186
+ dotnet user-secrets set " AppConfig:Database:Connections:1:Provider" " $DB_PROVIDER "
187
+
168
188
cd ..
169
189
```
170
190
191
+ - example result of ` dotnet user-secrets list `
192
+
193
+ ``` sh
194
+ AppConfig:Database:Seed:Users:0:Username = admin
195
+ AppConfig:Database:Seed:Users:0:Roles:0 = admin
196
+ AppConfig:Database:Seed:Users:0:Password = ADMINPASS
197
+ AppConfig:Database:Seed:Users:0:Email = ADMIN@EMAIL.COM
198
+ AppConfig:Database:Connections:1:Provider = Postgres
199
+ AppConfig:Database:Connections:1:Name = UnitTest
200
+ AppConfig:Database:Connections:1:ConnectionString = Host=localhost; Database=ExampleWebAppTest; Username=example_webapp_user; Password=DBPASS
201
+ AppConfig:Database:Connections:0:Provider = Postgres
202
+ AppConfig:Database:Connections:0:Name = Development
203
+ AppConfig:Database:Connections:0:ConnectionString = Host=localhost; Database=ExampleWebApp; Username=example_webapp_user; Password=DBPASS
204
+ AppConfig:Database:ConnectionName = Development
205
+ AppConfig:Auth:Jwt:Key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
206
+ ```
207
+
171
208
### configuration parameters for mail server
172
209
173
210
- to be able to use the reset password feature configure also the smtp server
@@ -396,7 +433,7 @@ dotnet user-secrets set "ConnectionStrings:UnitTest" "$TEST_DB_CONN_STRING"
396
433
cd ../../..
397
434
```
398
435
399
- - to run tests
436
+ - to run tests ( requires about 1 min to complete )
400
437
401
438
``` sh
402
439
dotnet test
@@ -410,29 +447,30 @@ dotnet test --filter=TEST
410
447
411
448
#### configuration parameters
412
449
413
- | param name | description | example |
414
- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
415
- | AppServerName | Used to build [ app url] [ 10 ] for the reset password link. | "dev-webapp-test.searchathing.local" |
416
- | DbProvider | Used to [ inject db provider service] [ 12 ] . | "Postgres" |
417
- | ConnectionStrings: Main | Used to build application [ db context datasource] [ 11 ] . | "Host=localhost; Database=ExampleWebApp; Username=postgres; Password=somepass" |
418
- | IsUnitTest | Used to build [ unit test application datasource] [ 11 ] in unit test mode. Will be set to ` true ` from the [ test factory] [ 13 ] . | false |
419
- | ConnectionStrings: UnitTest | Need to be set in order to run unit tests. Warning: database referred by this conn string will be dropped during tests. | "Host=localhost; Database=ExampleWebAppTest; Username=postgres; Password=somepass" |
420
- | JwtSettings: Key | Symmetric key for JWT signature generation. | (results from ` openssl rand -hex 32 ` command) |
421
- | JwtSettings: Issuer | Issuer of the JWT access token. | "https://www.example.com" |
422
- | JwtSettings: Audience | Audience of the JWT access token. | "https://www.example.com/app" |
423
- | JwtSettings: AccessTokenDurationSeconds | JWT access token duration (seconds) | 300 |
424
- | JwtSettings: RefreshTokenDurationSeconds | JWT refresh token duration (seconds) | 1200 |
425
- | JwtSettings: ClockSkewSeconds | JWT access token clock skew (seconds) | 0 |
426
- | SeedUsers:Admin: UserName | Default seeded admin username | admin |
427
- | SeedUsers:Admin: Password | Default seeded admin password | SomePass1! |
428
- | SeedUsers:Admin: Email | Default seeded admin email | admin@some.com |
429
- | EmailServer: Username | Email server config used in reset password ( account username ) | server@some.com |
430
- | EmailServer: Password | Email server config used in reset password ( account password ) | |
431
- | EmailServer: SmtpServerName | Email server config used in reset password ( account smtp server ) | smtp@some.com |
432
- | EmailServer: SmtpServerPort | Email server config used in reset password ( account smtp port ) | 587 |
433
- | EmailServer: Security | Email server config used in reset password ( account protocol security ) | "Tls" |
434
- | EmailServer: FromDisplayName | Email server config used in reset password ( account displayname of the sender ) | "Server" |
435
- | DbSchemaSnakeCase | if true generates db schema with snake case mode ( useful for Postgres ) | |
450
+ | param name | description | example |
451
+ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
452
+ | Server: HostName | Used to build [ app url] [ 10 ] for the reset password link. | "dev-webapp-test.searchathing.local" |
453
+ | Database: SchemaSnakeCase | if true generates db schema with snake case mode ( useful for Postgres ) | |
454
+ | Database: ConnectionName | Connection to user. | "Development" |
455
+ | Database:Connections:IDX: Provider | Used to [ inject db provider service] [ 12 ] . | "Postgres" |
456
+ | Database:Connections:IDX: ConnectionString | Used to build application [ db context datasource] [ 11 ] . | "Host=localhost; Database=ExampleWebApp; Username=postgres; Password=somepass" |
457
+ | Database:Seed:Users:IDX: UserName | Default seeded user username | admin |
458
+ | Database:Seed:Users:IDX: Password | Default seeded user password | SomePass1! |
459
+ | Database:Seed:Users:IDX: Email | Default seeded user email | admin@some.com |
460
+ | Database:Seed:Users:IDX: Roles | Default seeded user roles | admin |
461
+ | Auth:JwtSettings: Key | Symmetric key for JWT signature generation. | (results from ` openssl rand -hex 32 ` command) |
462
+ | Auth:JwtSettings: Issuer | Issuer of the JWT access token. | "https://www.example.com" |
463
+ | Auth:JwtSettings: Audience | Audience of the JWT access token. | "https://www.example.com/app" |
464
+ | Auth:JwtSettings: AccessTokenDuration | JWT access token duration (TimeSpan) | "00:00:30" |
465
+ | Auth:JwtSettings: RefreshTokenDuration | JWT refresh token duration (TimeSpan) | "7.00:00:00" |
466
+ | Auth:JwtSettings: ClockSkew | JWT access token clock skew (TimeSpan) | "00:00:00" |
467
+ | EmailServer: Username | Email server config used in reset password ( account username ) | server@some.com |
468
+ | EmailServer: Password | Email server config used in reset password ( account password ) | |
469
+ | EmailServer: SmtpServer | Email server config used in reset password ( account smtp server ) | smtp@some.com |
470
+ | EmailServer: SmtpServerPort | Email server config used in reset password ( account smtp port ) | 587 |
471
+ | EmailServer: Security | Email server config used in reset password ( account protocol security ) | "Tls" |
472
+ | EmailServer: FromDisplayName | Email server config used in reset password ( account displayname of the sender ) | "Server" |
473
+ | IsUnitTest | Used to build [ unit test application datasource] [ 11 ] in unit test mode. Will be set to ` true ` from the [ test factory] [ 13 ] . | false |
436
474
437
475
The configuration is setup through [ SetupAppSettings] [ 14 ] method in order to evaluate:
438
476
- ` appsettings.json `
0 commit comments