Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Initialisieren Sie eine neue Konfigurationsdatei des Daten-API-Generators. Der resultierende JSON erfasst Datenquellendetails, aktivierte Endpunkte (REST, GraphQL, MCP), Authentifizierung und Laufzeitverhalten.
Syntax
dab init [options]
Wenn die Zielkonfigurationsdatei bereits vorhanden ist, überschreibt der Befehl sie. Es gibt keine Zusammenführung. Verwenden Sie die Versionssteuerung oder Sicherungen, wenn Sie die vorherige Datei beibehalten müssen.
Schnellblick
| Option | Zusammenfassung |
|---|---|
-c, --config |
Dateiname der Ausgabekonfiguration (Standard-dab-config.json) |
Authentifizierung
| Option | Zusammenfassung |
|---|---|
--auth.audience |
JWT-Zielgruppenanspruch |
--auth.issuer |
JWT-Ausstelleranspruch |
--auth.provider |
Identitätsanbieter (Default StaticWebApps) |
Datenquelle
| Option | Zusammenfassung |
|---|---|
--connection-string |
Datenbankverbindungszeichenfolge (unterstützt @env()) |
--cosmosdb_nosql-container |
Cosmos DB NoSQL-Containername (optional) |
--cosmosdb_nosql-database |
Cosmos DB NoSQL-Datenbankname (erforderlich für cosmosdb_nosql) |
--database-type |
Datenbanktyp: mssql, mysql, postgresql, , cosmosdb_postgresqlcosmosdb_nosql |
--set-session-context |
Aktivieren des SQL Server-Sitzungskontexts (nur mssql) |
GraphQL
| Option | Zusammenfassung |
|---|---|
--graphql.disabled |
Deprecated. Deaktiviert GraphQL (Verwenden --graphql.enabled false) |
--graphql.enabled |
Aktivieren von GraphQL (Standard true) |
--graphql.multiple-create.enabled |
Mehrere Erstellen von Mutationen zulassen (Standard false) |
--graphql.path |
GraphQL-Endpunktpräfix (Standard /graphql) |
--graphql-schema |
Pfad zum GraphQL-Schema (erforderlich für cosmosdb_nosql) |
Host und Authentifizierung
| Option | Zusammenfassung |
|---|---|
--host-mode |
Hostmodus: Entwicklung oder Produktion (Standardproduktion) |
--cors-origin |
Liste zulässiger Ursprünge (durch Trennzeichen getrennt) |
--runtime.base-route |
Globales Präfix für alle Endpunkte |
MCP
| Option | Zusammenfassung |
|---|---|
--mcp.disabled |
Deprecated. Deaktiviert MCP (Verwendung --mcp.enabled false) |
--mcp.enabled |
AKTIVIEREN von MCP (Standard true) |
--mcp.path |
MCP-Endpunktpräfix (Standard /mcp) |
Hinweis
MCP-Funktion ist Teil der Version 1.7.
REST
| Option | Zusammenfassung |
|---|---|
--rest.disabled |
Deprecated. Deaktiviert REST (Verwenden --rest.enabled false) |
--rest.enabled |
Rest aktivieren (Standard true, prefer over --rest.disabled) |
--rest.path |
REST-Endpunktpräfix (Standard-/API, für cosmosdb_nosql ignoriert) |
--rest.request-body-strict |
Erzwingen der strengen Anforderungstextüberprüfung (Standard true, für cosmosdb_nosql ignoriert) |
Von Bedeutung
Mischen Sie nicht die neuen --*.enabled Flags und die Legacy-Flags --*.disabled für dasselbe Subsystem im selben Befehl. Bevorzugen Sie das --*.enabled Muster; die --graphql.disabled--rest.disabledWarnungen für das Protokoll von Optionen und --mcp.disabled werden in zukünftigen Versionen entfernt.
-c, --config
Name der Ausgabekonfigurationsdatei. Der Standardwert ist dab-config.json.
Example
dab init --database-type mssql --config dab-config.local.json
Resultierende Konfiguration
{
"data-source": {
"database-type": "mssql",
"connection-string": "@env('MSSQL_CONNECTION_STRING')"
}
}
--auth.audience
JWT-Zielgruppenanspruch.
Example
dab init --database-type mssql --auth.audience "https://example.com/api"
Resultierende Konfiguration
{
"runtime": {
"authentication": {
"audience": "https://example.com/api"
}
}
}
--auth.issuer
JWT-Ausstelleranspruch.
Example
dab init --database-type mssql --auth.issuer "https://login.microsoftonline.com/{tenant-id}/v2.0"
Resultierende Konfiguration
{
"runtime": {
"authentication": {
"issuer": "https://login.microsoftonline.com/{tenant-id}/v2.0"
}
}
}
--auth.provider
Identitätsanbieter. Der Standardwert ist StaticWebApps.
Example
dab init --database-type mssql --auth.provider AzureAD
Resultierende Konfiguration
{
"runtime": {
"authentication": {
"provider": "AzureAD"
}
}
}
--connection-string
Datenbankverbindungszeichenfolge. Unterstützt @env().
Example
dab init --database-type mssql --connection-string "@env('MSSQL_CONNECTION_STRING')"
Resultierende Konfiguration
{
"data-source": {
"connection-string": "@env('MSSQL_CONNECTION_STRING')"
}
}
--cors-origin
Durch Trennzeichen getrennte Liste zulässiger Ursprünge.
Example
dab init --database-type mssql --cors-origin "https://app.example.com,https://admin.example.com"
Resultierende Konfiguration
{
"runtime": {
"cors": {
"origins": [ "https://app.example.com", "https://admin.example.com" ]
}
}
}
--cosmosdb_nosql-container
Name des Cosmos DB NoSQL-Containers.
Example
dab init --database-type cosmosdb_nosql --cosmosdb_nosql-container MyContainer
Resultierende Konfiguration
{
"data-source": {
"database-type": "cosmosdb_nosql",
"options": {
"container": "MyContainer"
}
}
}
--cosmosdb_nosql-database
Name der Cosmos DB NoSQL-Datenbank. Erforderlich für cosmosdb_nosql.
Example
dab init --database-type cosmosdb_nosql --cosmosdb_nosql-database MyDb
Resultierende Konfiguration
{
"data-source": {
"database-type": "cosmosdb_nosql",
"options": {
"database": "MyDb"
}
}
}
--database-type
Gibt das Zieldatenbankmodul an. Unterstützte Werte: mssql, mysql, postgresql, cosmosdb_postgresql, cosmosdb_nosql.
Example
dab init --database-type mssql
Resultierende Konfiguration
{
"data-source": {
"database-type": "mssql"
}
}
--graphql.disabled
Deprecated. Deaktiviert GraphQL. Prefer --graphql.enabled false.
--graphql.enabled
Aktivieren Sie den GraphQL-Endpunkt. Der Standardwert ist true.
Example
dab init --database-type mssql --graphql.enabled false
Resultierende Konfiguration
{
"runtime": {
"graphql": {
"enabled": false
}
}
}
--graphql.multiple-create.enabled
Ermöglicht die Erstellung mehrerer Zeilen in einer einzelnen Mutation. Der Standardwert ist false.
Example
dab init --database-type mssql --graphql.multiple-create.enabled true
Resultierende Konfiguration
{
"runtime": {
"graphql": {
"multiple-create": { "enabled": true }
}
}
}
--graphql.path
GraphQL-Endpunktpräfix. Der Standardwert ist /graphql.
Example
dab init --database-type mssql --graphql.path /gql
Resultierende Konfiguration
{
"runtime": {
"graphql": {
"path": "/gql"
}
}
}
--graphql-schema
Pfad zu einer GraphQL-Schemadatei. Erforderlich für cosmosdb_nosql.
Example
dab init --database-type cosmosdb_nosql --graphql-schema ./schema.gql
Resultierende Konfiguration
{
"runtime": {
"graphql": {
"schema": "./schema.gql"
}
}
}
--host-mode
Hostmodus. Der Standardwert ist Production.
Gültige Werte: Development, Production.
Example
dab init --database-type mssql --host-mode development
Resultierende Konfiguration
{
"runtime": {
"host": {
"mode": "development"
}
}
}
--mcp.disabled
Deprecated. Deaktiviert MCP. Prefer --mcp.enabled false.
--mcp.enabled
Aktivieren Sie den MCP-Endpunkt. Der Standardwert ist true.
Example
dab init --database-type mssql --mcp.enabled false
Resultierende Konfiguration
{
"runtime": {
"mcp": {
"enabled": false
}
}
}
--mcp.path
MCP-Endpunktpräfix. Der Standardwert ist /mcp.
Example
dab init --database-type mssql --mcp.path /model
Resultierende Konfiguration
{
"runtime": {
"mcp": {
"path": "/model"
}
}
}
--rest.disabled
Deprecated. Deaktiviert REST. Prefer --rest.enabled false.
--rest.enabled
Aktivieren Sie den REST-Endpunkt. Der Standardwert ist true.
Example
dab init --database-type mssql --rest.enabled false
Resultierende Konfiguration
{
"runtime": {
"rest": {
"enabled": false
}
}
}
--rest.path
REST-Endpunktpräfix. Der Standardwert ist /api.
Hinweis
Ignoriert für cosmosdb_nosql.
Example
dab init --database-type mssql --rest.path /rest
Resultierende Konfiguration
{
"runtime": {
"rest": {
"path": "/rest"
}
}
}
--rest.request-body-strict
Steuert die Behandlung zusätzlicher Felder in Anforderungstexten. Der Standardwert ist true.
-
true: Lehnt überflüssige Felder (HTTP 400) ab. -
false: Ignoriert zusätzliche Felder.
Hinweis
Ignoriert für cosmosdb_nosql.
Example
dab init --database-type mssql --rest.request-body-strict false
Resultierende Konfiguration
{
"runtime": {
"rest": {
"request-body-strict": false
}
}
}
--runtime.base-route
Das globale Präfix wird allen Endpunkten vorangestellt. Muss mit /.
Example
dab init --database-type mssql --runtime.base-route /v1
Resultierende Konfiguration
{
"runtime": {
"base-route": "/v1"
}
}
--set-session-context
Aktivieren des Sendens von Daten an SQL Server mithilfe des Sitzungskontexts. Nur gültig für mssql. Der Standardwert ist false.
Example
dab init --database-type mssql --set-session-context true
Resultierende Konfiguration
{
"runtime": {
"mssql": {
"set-session-context": true
}
}
}