Delen via


init opdracht

Initialiseer een nieuw configuratiebestand voor data-API builder. De resulterende JSON legt gegevensbrondetails vast, ingeschakelde eindpunten (REST, GraphQL, MCP), verificatie en runtimegedrag.

Syntaxis

dab init [options]

Als het doelconfiguratiebestand al bestaat, overschrijft de opdracht het. Er is geen samenvoeging. Gebruik versiebeheer of back-ups als u het vorige bestand wilt behouden.

Snelle blik

Optie Samenvatting
-c, --config Naam van uitvoerconfiguratiebestand (standaard dab-config.json)

Sectie Verificatie

Optie Samenvatting
--auth.audience JSON Web Token (JWT)-doelgroepclaim
--auth.issuer JSON Web Token (JWT)-verlenerclaim
--auth.provider Id-provider (standaard Unauthenticated)

Sectie Gegevensbron

Optie Samenvatting
--connection-string Databaseverbindingsreeks (ondersteunt @env())
--cosmosdb_nosql-container Naam van Cosmos DB NoSQL-container (optioneel)
--cosmosdb_nosql-database Naam van Cosmos DB NoSQL-database (vereist voor cosmosdb_nosql)
--database-type Databasetype: mssql, mysql, postgresql, , cosmosdb_postgresqlcosmosdb_nosql
--set-session-context Sql Server-sessiecontext inschakelen (alleen mssql)

GraphQL-sectie

Optie Samenvatting
--graphql.disabled Afgeschreven Hiermee wordt GraphQL uitgeschakeld (gebruik --graphql.enabled false)
--graphql.enabled GraphQL inschakelen (standaard true)
--graphql.multiple-create.enabled Meervoudige maakmutaties toestaan (standaard onwaar)
--graphql.path GraphQL-eindpuntvoorvoegsel (standaard /graphql)
--graphql-schema Pad naar GraphQL-schema (vereist voor cosmosdb_nosql)

Sectie Host en verificatie

Optie Samenvatting
--host-mode Hostmodus: Ontwikkeling of Productie (standaardproductie)
--cors-origin Lijst met toegestane oorsprongen (door komma's gescheiden)
--runtime.base-route Globaal voorvoegsel voor alle eindpunten

MCP-sectie

Optie Samenvatting
--mcp.aggregate-records.query-timeout Time-out voor hulpprogramma's voor statistische records in seconden (standaard 30, bereik 1-600)
--mcp.disabled Afgeschreven Schakelt MCP (gebruik) uit --mcp.enabled false
--mcp.enabled MCP inschakelen (standaard true)
--mcp.path MCP-eindpuntvoorvoegsel (standaard /mcp)

Opmerking

MCP-mogelijkheid is beschikbaar in versie 1.7 en hoger.

REST-sectie

Optie Samenvatting
--rest.disabled Afgeschreven Schakelt REST uit (gebruik --rest.enabled false)
--rest.enabled REST inschakelen (standaard true, voorkeur boven --rest.disabled)
--rest.path REST-eindpuntvoorvoegsel (standaard/API, genegeerd voor cosmosdb_nosql)
--rest.request-body-strict Strikte validatie van aanvraagbody afdwingen (standaard onwaar, genegeerd voor cosmosdb_nosql)

Belangrijk

Meng de nieuwe --*.enabled vlaggen en de verouderde --*.disabled vlaggen voor hetzelfde subsysteem niet in dezelfde opdracht. Geef de voorkeur aan het --*.enabled patroon; de --rest.disabled--graphql.disabledwaarschuwingen en opties voor logboeken en --mcp.disabled worden verwijderd in toekomstige versies.

-c, --config

Naam van uitvoerconfiguratiebestand. De standaardinstelling is dab-config.json.

Example

dab init \
  --database-type mssql \
  --config dab-config.local.json

Resulterende configuratie

{
  "data-source": {
    "database-type": "mssql",
    "connection-string": ""
  }
}

--auth.audience

JSON Web Token (JWT)-doelgroepclaim.

Example

dab init \
  --database-type mssql \
  --auth.audience "https://example.com/api"

Resulterende configuratie

{
  "runtime": {
    "host": {
      "authentication": {
        "jwt": {
          "audience": "https://example.com/api"
        }
      }
    }
  }
}

--auth.issuer

JSON Web Token (JWT)-verlenerclaim.

Example

dab init \
  --database-type mssql \
  --auth.issuer "https://login.microsoftonline.com/{tenant-id}/v2.0"

Resulterende configuratie

{
  "runtime": {
    "host": {
      "authentication": {
        "jwt": {
          "issuer": "https://login.microsoftonline.com/{tenant-id}/v2.0"
        }
      }
    }
  }
}

--auth.provider

Id-provider. De standaardinstelling is Unauthenticated.

Als Unauthenticated dab actief is, inspecteert of valideert DAB geen JWT. Alle aanvragen worden uitgevoerd als anonymous. Een andere service kan aanvragen verifiëren of filteren voordat ze DAB bereiken, maar DAB autoriseert nog steeds alleen als anonymous. Als u een andere provider wilt gebruiken, stelt u deze expliciet in.

Zie De niet-geverifieerde provider configureren voor configuratierichtlijnen.

Opmerking

De data-API builder 2.0-functionaliteit die in deze sectie wordt beschreven, is momenteel in preview en kan veranderen vóór algemene beschikbaarheid. Zie Wat is er nieuw in versie 2.0 voor meer informatie.

Geldige waarden: Unauthenticated, StaticWebApps, EntraID, AzureAD, , AppService, Simulator. Custom

Belangrijk

Andere providers dan Unauthenticated, StaticWebAppsen vereisen --auth.audience en Simulator--auth.issuer.

Example

dab init \
  --database-type mssql \
  --auth.provider AzureAD \
  --auth.audience "https://example.com/api" \
  --auth.issuer "https://login.microsoftonline.com/{tenant-id}/v2.0"

Resulterende configuratie

{
  "runtime": {
    "host": {
      "authentication": {
        "provider": "AzureAD",
        "jwt": {
          "audience": "https://example.com/api",
          "issuer": "https://login.microsoftonline.com/{tenant-id}/v2.0"
        }
      }
    }
  }
}

--connection-string

Databaseverbindingsreeks. Ondersteunt @env().

Example

dab init \
  --database-type mssql \
  --connection-string "@env('MSSQL_CONNECTION_STRING')"

Resulterende configuratie

{
  "data-source": {
    "connection-string": "@env('MSSQL_CONNECTION_STRING')"
  }
}

--cors-origin

Door komma's gescheiden lijst met toegestane oorsprongen.

Example

dab init \
  --database-type mssql \
  --cors-origin "https://app.example.com,https://admin.example.com"

Resulterende configuratie

{
  "runtime": {
    "host": {
      "cors": {
        "origins": [ "https://app.example.com", "https://admin.example.com" ]
      }
    }
  }
}

--cosmosdb_nosql-container

Naam van Cosmos DB NoSQL-container.

Example

dab init \
  --database-type cosmosdb_nosql \
  --cosmosdb_nosql-container MyContainer

Resulterende configuratie

{
  "data-source": {
    "database-type": "cosmosdb_nosql",
    "options": {
      "container": "MyContainer"
    }
  }
}

--cosmosdb_nosql-database

Naam van Cosmos DB NoSQL-database. Vereist voor cosmosdb_nosql.

Example

dab init \
  --database-type cosmosdb_nosql \
  --cosmosdb_nosql-database MyDb

Resulterende configuratie

{
  "data-source": {
    "database-type": "cosmosdb_nosql",
    "options": {
      "database": "MyDb"
    }
  }
}

--database-type

Hiermee geeft u de doeldatabase-engine. Ondersteunde waarden: mssql, mysql, postgresql, cosmosdb_postgresql, cosmosdb_nosql.

Example

dab init \
  --database-type mssql

Resulterende configuratie

{
  "data-source": {
    "database-type": "mssql"
  }
}

--graphql.disabled

Afgeschreven Hiermee schakelt u GraphQL uit. Liever --graphql.enabled false.

--graphql.enabled

Het GraphQL-eindpunt inschakelen. De standaardinstelling is true.

Example

dab init \
  --database-type mssql \
  --graphql.enabled false

Resulterende configuratie

{
  "runtime": {
    "graphql": {
      "enabled": false
    }
  }
}

--graphql.multiple-create.enabled

Maakt het mogelijk om meerdere rijen in één mutatie te maken. De standaardinstelling is false.

Example

dab init \
  --database-type mssql \
  --graphql.multiple-create.enabled true

Resulterende configuratie

{
  "runtime": {
    "graphql": {
      "multiple-mutations": {
        "create": { "enabled": true }
      }
    }
  }
}

--graphql.path

GraphQL-eindpuntvoorvoegsel. De standaardinstelling is /graphql.

Example

dab init \
  --database-type mssql \
  --graphql.path /gql

Resulterende configuratie

{
  "runtime": {
    "graphql": {
      "path": "/gql"
    }
  }
}

--graphql-schema

Pad naar een GraphQL-schemabestand. Vereist voor cosmosdb_nosql.

Example

dab init \
  --database-type cosmosdb_nosql \
  --graphql-schema ./schema.gql

Resulterende configuratie

{
  "data-source": {
    "database-type": "cosmosdb_nosql",
    "options": {
      "schema": "./schema.gql"
    }
  }
}

--host-mode

Hostmodus. De standaardinstelling is Production.

Geldige waarden: Development, Production.

Example

dab init \
  --database-type mssql \
  --host-mode development

Resulterende configuratie

{
  "runtime": {
    "host": {
      "mode": "development"
    }
  }
}

--mcp.aggregate-records.query-timeout

Time-out voor uitvoering in seconden voor het MCP-hulpprogramma voor statistische records. De standaardinstelling is 30. Bereik: 1600.

Example

dab init \
  --database-type mssql \
  --mcp.aggregate-records.query-timeout 60

Resulterende configuratie

{
  "runtime": {
    "mcp": {
      "dml-tools": {
        "aggregate-records": {
          "query-timeout": 60
        }
      }
    }
  }
}

--mcp.disabled

Afgeschreven Schakelt MCP uit. Liever --mcp.enabled false.

--mcp.enabled

Schakel HET MCP-eindpunt in. De standaardinstelling is true.

Example

dab init \
  --database-type mssql \
  --mcp.enabled false

Resulterende configuratie

{
  "runtime": {
    "mcp": {
      "enabled": false
    }
  }
}

--mcp.path

MCP-eindpuntvoorvoegsel. De standaardinstelling is /mcp.

Example

dab init \
  --database-type mssql \
  --mcp.path /model

Resulterende configuratie

{
  "runtime": {
    "mcp": {
      "path": "/model"
    }
  }
}

--rest.disabled

Afgeschreven Schakelt REST uit. Liever --rest.enabled false.

--rest.enabled

Schakel REST-eindpunt in. De standaardinstelling is true.

Example

dab init \
  --database-type mssql \
  --rest.enabled false

Resulterende configuratie

{
  "runtime": {
    "rest": {
      "enabled": false
    }
  }
}

--rest.path

REST-eindpuntvoorvoegsel. De standaardinstelling is /api.

Opmerking

Genegeerd voor cosmosdb_nosql.

Example

dab init \
  --database-type mssql \
  --rest.path /rest

Resulterende configuratie

{
  "runtime": {
    "rest": {
      "path": "/rest"
    }
  }
}

--rest.request-body-strict

Hiermee bepaalt u de verwerking van extra velden in aanvraagteksten. De standaardinstelling is false.

  • true: Weigert overbodige velden (HTTP 400).
  • false: Hiermee worden extra velden genegeerd.

Opmerking

Genegeerd voor cosmosdb_nosql.

Example

dab init \
  --database-type mssql \
  --rest.request-body-strict false

Resulterende configuratie

{
  "runtime": {
    "rest": {
      "request-body-strict": false
    }
  }
}

--runtime.base-route

Globaal voorvoegsel dat is voorafgegaan aan alle eindpunten. Moet beginnen met /.

Belangrijk

Voor deze optie moet de verificatieprovider zijn StaticWebApps. --runtime.base-routeNaast elkaar instellen--auth.provider StaticWebApps.

Example

dab init \
  --database-type mssql \
  --auth.provider StaticWebApps \
  --runtime.base-route /v1

Resulterende configuratie

{
  "runtime": {
    "base-route": "/v1"
  }
}

--set-session-context

Schakel het verzenden van gegevens naar SQL Server in met behulp van sessiecontext. Alleen geldig voor mssql. De standaardinstelling is false.

Example

dab init \
  --database-type mssql \
  --set-session-context true

Resulterende configuratie

{
  "data-source": {
    "database-type": "mssql",
    "options": {
      "set-session-context": true
    }
  }
}