Data Settings
These are Endatix API settings (Endatix:Data). They control migrations and sample seeding.
Configuration
To configure the data settings, add the following snippet to your appsettings.json file. Customize the values based on your requirements:
"Endatix": {
"Data": {
"EnableAutoMigrations": true,
"SeedSampleData": true,
"InitialUser": {
"Email": "admin@example.com",
"Password": "StrongPassword123!"
}
}
}
Settings Reference
| Setting | Description | Default |
|---|---|---|
EnableAutoMigrations | Controls whether database migrations are automatically applied at application startup | false |
SeedSampleData | Controls whether initial sample data (including user) is seeded at startup | false |
InitialUser | Configuration for the initial admin user when seeding sample data | (see below) |
InitialUser Options
When SeedSampleData is enabled, you can configure the initial user with these properties:
| Property | Description | Required |
|---|---|---|
Email | Email address for the initial user | Yes |
Password | Password for the initial user | Yes |
Programmatic Configuration
You can also configure data settings using the builder pattern:
builder.Services.AddEndatix(configuration)
.Persistence
.EnableAutoMigrations(true)
.EnableSampleDataSeeding(true)
.Build();
Note on importance
🔥 Data settings are a critical part of your deployment strategy. You should carefully decide when and if data migrations and seeding are executed to ensure your database schema and data are properly managed according to your application's needs.