configure 命令

在现有数据 API 生成器配置文件中配置非实体运行时和数据源属性。 未指定的选项使现有值保持不变。 如果提供的任何选项无效,则整个更新将失败(全无)。

Syntax

dab configure [options]

注释

此命令不会更改节 entities 。 用于 dab update 实体更改。

快速浏览

选项 概要
-c, --config 配置文件的路径(默认值 dab-config.json)。
--data-source.database-type 设置数据库类型。
--data-source.connection-string 设置数据库连接字符串。
--data-source.options.database Cosmos DB for NoSql 的数据库名称。
--data-source.options.container Cosmos DB for NoSql 的容器名称。
--data-source.options.schema Cosmos DB for NoSql 的架构路径。
--data-source.options.set-session-context 启用会话上下文。
--runtime.graphql.depth-limit 限制最大查询深度。
--runtime.graphql.enabled 启用或禁用 GraphQL 终结点。
--runtime.graphql.path 自定义 GraphQL 终结点路径。
--runtime.graphql.allow-introspection 允许或拒绝 GraphQL 反省。
--runtime.graphql.multiple-mutations.create.enabled 启用多创建突变。
--runtime.rest.enabled 启用或禁用 REST 终结点。
--runtime.rest.path 自定义 REST 终结点路径。
--runtime.rest.request-body-strict 强制实施严格的 REST 请求正文验证。
--runtime.mcp.enabled 启用或禁用 MCP 终结点。
--runtime.mcp.path 自定义 MCP 终结点路径。
--runtime.mcp.dml-tools.enabled 启用或禁用所有 MCP DML 工具。
--runtime.mcp.dml-tools.describe-entities.enabled 启用或禁用描述实体工具。
--runtime.mcp.dml-tools.create-record.enabled 启用或禁用创建记录工具。
--runtime.mcp.dml-tools.read-records.enabled 启用或禁用读取记录工具。
--runtime.mcp.dml-tools.update-record.enabled 启用或禁用更新记录工具。
--runtime.mcp.dml-tools.delete-record.enabled 启用或禁用删除记录工具。
--runtime.mcp.dml-tools.execute-entity.enabled 启用或禁用执行实体工具。
--runtime.cache.enabled 启用或禁用全局缓存。
--runtime.cache.ttl-seconds 全局缓存 TTL(以秒为单位)。
--runtime.host.mode 设置主机模式:开发或生产。
--runtime.host.cors.origins 允许的 CORS 源。
--runtime.host.cors.allow-credentials 设置 CORS 允许凭据。
--runtime.host.authentication.provider 身份验证提供程序。
--runtime.host.authentication.jwt.audience JWT 受众声明。
--runtime.host.authentication.jwt.issuer JWT 颁发者声明。
--azure-key-vault.endpoint Azure Key Vault 基本终结点。
--azure-key-vault.retry-policy.mode 重试策略模式。
--azure-key-vault.retry-policy.max-count 最大重试尝试次数。
--azure-key-vault.retry-policy.delay-seconds 重试之间的延迟。
--azure-key-vault.retry-policy.max-delay-seconds 指数重试的最大延迟。
--azure-key-vault.retry-policy.network-timeout-seconds 网络调用超时。
--runtime.telemetry.azure-log-analytics.enabled 启用 Azure Log Analytics 遥测。
--runtime.telemetry.azure-log-analytics.dab-identifier 区分日志源。
--runtime.telemetry.azure-log-analytics.flush-interval-seconds 以秒为单位刷新节奏。
--runtime.telemetry.azure-log-analytics.auth.custom-table-name 自定义表名称。
--runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id 数据收集规则 ID。
--runtime.telemetry.azure-log-analytics.auth.dce-endpoint 数据收集终结点。
--runtime.telemetry.file.enabled 启用文件接收器遥测。
--runtime.telemetry.file.path 日志文件的路径。
--runtime.telemetry.file.rolling-interval 滚动间隔。
--runtime.telemetry.file.retained-file-count-limit 保留的最大文件数。
--runtime.telemetry.file.file-size-limit-bytes 滚动之前每个文件的最大大小。
--help 显示此帮助屏幕。
--version 显示版本信息。

-c, --config

配置文件的路径。 默认值为 dab-config.json 除非 dab-config.<DAB_ENVIRONMENT>.json 存在,否则为 DAB_ENVIRONMENT 环境变量。

Example

dab configure \
  --config ./dab-config.json \
  --runtime.rest.enabled true

--data-source.database-type

数据库类型。

允许的值:

  • MSSQL
  • PostgreSQL
  • CosmosDB_NoSQL
  • MySQL

Example

dab configure \
  --data-source.database-type PostgreSQL

生成的配置

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

--data-source.connection-string

数据源的连接字符串。

Example

dab configure \
  --data-source.connection-string "Server=myserver;Database=mydb;User Id=myuser;Password=mypassword;"

--data-source.options.database

Cosmos DB for NoSql 的数据库名称。

Example

dab configure \
  --data-source.options.database MyCosmosDatabase

--data-source.options.container

Cosmos DB for NoSql 的容器名称。

Example

dab configure \
  --data-source.options.container MyCosmosContainer

--data-source.options.schema

Cosmos DB for NoSql 的架构路径。

Example

dab configure \
  --data-source.options.schema ./schema.gql

--data-source.options.set-session-context

启用会话上下文。

允许的值:

  • true(默认值)
  • false

Example

dab configure \
  --data-source.options.set-session-context false

生成的配置

{
  "data-source": {
    "options": {
      "set-session-context": false
    }
  }
}

--runtime.graphql.depth-limit

嵌套查询的最大允许深度。

允许的值:

  • $(0,2147483647]$ (含)
  • -1 删除限制

Example

dab configure \
  --runtime.graphql.depth-limit 3

生成的配置

{
  "runtime": {
    "graphql": {
      "depth-limit": 3
    }
  }
}

--runtime.graphql.enabled

启用 DAB 的 GraphQL 终结点。

Example

dab configure \
  --runtime.graphql.enabled false

--runtime.graphql.path

自定义 DAB 的 GraphQL 终结点路径。 带有 . 的 /前缀路径。

Example

dab configure \
  --runtime.graphql.path /graphql

--runtime.graphql.allow-introspection

允许或拒绝 GraphQL 反省请求。

Example

dab configure \
  --runtime.graphql.allow-introspection false

--runtime.graphql.multiple-mutations.create.enabled

启用或禁用生成的 GraphQL 架构中的多突变创建作。

Example

dab configure \
  --runtime.graphql.multiple-mutations.create.enabled true

--runtime.rest.enabled

启用 DAB 的 REST 终结点。

Example

dab configure \
  --runtime.rest.enabled false

--runtime.rest.path

自定义 DAB 的 REST 终结点路径。 带有 . 的 /前缀路径。

Example

dab configure \
  --runtime.rest.path /myapi

生成的配置

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

--runtime.rest.request-body-strict

禁止多余的 REST 请求正文字段。

Example

dab configure \
  --runtime.rest.request-body-strict true

--runtime.mcp.enabled

启用 DAB 的 MCP 终结点。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.enabled false

生成的配置

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

--runtime.mcp.path

自定义 DAB 的 MCP 终结点路径。 带有 . 的 /前缀路径。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.path /mcp2

生成的配置

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

--runtime.mcp.dml-tools.enabled

启用 DAB 的 MCP DML 工具终结点。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.enabled false

--runtime.mcp.dml-tools.describe-entities.enabled

启用 DAB 的 MCP 描述实体工具。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.describe-entities.enabled false

--runtime.mcp.dml-tools.create-record.enabled

启用 DAB 的 MCP 创建记录工具。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.create-record.enabled false

--runtime.mcp.dml-tools.read-records.enabled

启用 DAB 的 MCP 读取记录工具。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.read-records.enabled false

--runtime.mcp.dml-tools.update-record.enabled

启用 DAB 的 MCP 更新记录工具。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.update-record.enabled false

--runtime.mcp.dml-tools.delete-record.enabled

启用 DAB 的 MCP 删除记录工具。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.delete-record.enabled false

--runtime.mcp.dml-tools.execute-entity.enabled

启用 DAB 的 MCP 执行实体工具。

注释

此选项仅在 v1.7 预发行版 CLI(当前 RC)中可用。 使用 dotnet tool install microsoft.dataapibuilder --prerelease. 安装 。

Example

dab configure \
  --runtime.mcp.dml-tools.execute-entity.enabled false

--runtime.cache.enabled

全局启用 DAB 的缓存。 还必须为每个实体启用缓存。

Example

dab configure \
  --runtime.cache.enabled true

生成的配置

{
  "runtime": {
    "cache": {
      "enabled": true
    }
  }
}

--runtime.cache.ttl-seconds

自定义 DAB 缓存的全局默认生存时间(以秒为单位)。

Example

dab configure \
  --runtime.cache.ttl-seconds 30

生成的配置

{
  "runtime": {
    "cache": {
      "enabled": false,
      "ttl-seconds": 30
    }
  }
}

--runtime.host.mode

设置 DAB 的主机运行模式。

允许的值:

  • Development
  • Production

Example

dab configure \
  --runtime.host.mode Development

生成的配置

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

--runtime.host.cors.origins

覆盖 CORS 中允许的源。 以空格分隔的列表的形式提供值。

Example

dab configure \
  --runtime.host.cors.origins \
  https://contoso.com \
  https://fabrikam.com

生成的配置

{
  "runtime": {
    "host": {
      "cors": {
        "origins": [
          "https://contoso.com",
          "https://fabrikam.com"
        ]
      }
    }
  }
}

--runtime.host.cors.allow-credentials

设置标头的值 Access-Control-Allow-Credentials

Example

dab configure \
  --runtime.host.cors.allow-credentials true

--runtime.host.authentication.provider

配置身份验证提供程序的名称。

Example

dab configure \
  --runtime.host.authentication.provider AppService

--runtime.host.authentication.jwt.audience

配置 JWT 令牌的预期接收方。

Example

dab configure \
  --runtime.host.authentication.jwt.audience api://my-app

--runtime.host.authentication.jwt.issuer

配置颁发 JWT 令牌的实体。

Example

dab configure \
  --runtime.host.authentication.jwt.issuer https://login.microsoftonline.com/common/v2.0

生成的配置

{
  "runtime": {
    "host": {
      "authentication": {
        "provider": "AppService",
        "jwt": {
          "audience": "api://my-app",
          "issuer": "https://login.microsoftonline.com/common/v2.0"
        }
      }
    }
  }
}

--azure-key-vault.endpoint

配置 Azure Key Vault 终结点 URL。

Example

dab configure \
  --azure-key-vault.endpoint https://my-vault.vault.azure.net

--azure-key-vault.retry-policy.mode

配置重试策略模式。

允许的值:

  • fixed
  • exponential

Example

dab configure \
  --azure-key-vault.retry-policy.mode fixed

--azure-key-vault.retry-policy.max-count

配置最大重试次数。

Example

dab configure \
  --azure-key-vault.retry-policy.max-count 5

--azure-key-vault.retry-policy.delay-seconds

配置重试之间的初始延迟(以秒为单位)。

Example

dab configure \
  --azure-key-vault.retry-policy.delay-seconds 2

--azure-key-vault.retry-policy.max-delay-seconds

配置重试之间的最大延迟(对于指数模式)。

Example

dab configure \
  --azure-key-vault.retry-policy.max-delay-seconds 30

--azure-key-vault.retry-policy.network-timeout-seconds

为请求配置网络超时(以秒为单位)。

Example

dab configure \
  --azure-key-vault.retry-policy.network-timeout-seconds 20

生成的配置

{
  "azure-key-vault": {
    "retry-policy": {
      "mode": "fixed",
      "max-count": 5,
      "delay-seconds": 2,
      "max-delay-seconds": 30,
      "network-timeout-seconds": 20
    }
  }
}

--runtime.telemetry.azure-log-analytics.enabled

启用或禁用 Azure Log Analytics。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.enabled true

--runtime.telemetry.azure-log-analytics.dab-identifier

配置 Azure Log Analytics 中使用的 DAB 标识符字符串。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.dab-identifier MyDab

--runtime.telemetry.azure-log-analytics.flush-interval-seconds

为 Azure Log Analytics 配置刷新间隔(以秒为单位)。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.flush-interval-seconds 10

--runtime.telemetry.azure-log-analytics.auth.custom-table-name

为 Azure Log Analytics 配置自定义表名称。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.auth.custom-table-name MyDabLogs

--runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id

为 Azure Log Analytics 配置 DCR 不可变 ID。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id dcr-123

--runtime.telemetry.azure-log-analytics.auth.dce-endpoint

为 Azure Log Analytics 配置 DCE 终结点。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.auth.dce-endpoint https://example.eastus-1.ingest.monitor.azure.com

生成的配置

{
  "runtime": {
    "telemetry": {
      "azure-log-analytics": {
        "enabled": true,
        "auth": {
          "custom-table-name": "MyDabLogs",
          "dcr-immutable-id": "dcr-123",
          "dce-endpoint": "https://example.eastus-1.ingest.monitor.azure.com"
        },
        "dab-identifier": "MyDab",
        "flush-interval-seconds": 10
      }
    }
  }
}

--runtime.telemetry.file.enabled

启用或禁用文件接收器日志记录。

Example

dab configure \
  --runtime.telemetry.file.enabled true

--runtime.telemetry.file.path

配置文件接收器日志记录的路径。

Example

dab configure \
  --runtime.telemetry.file.path C:\\logs\\dab-log.txt

--runtime.telemetry.file.rolling-interval

为文件接收器日志记录配置滚动间隔。

允许的值:

  • Minute
  • Hour
  • Day
  • Month
  • Year
  • Infinite

Example

dab configure \
  --runtime.telemetry.file.rolling-interval Month

--runtime.telemetry.file.retained-file-count-limit

配置保留的最大文件数。

Example

dab configure \
  --runtime.telemetry.file.retained-file-count-limit 5

--runtime.telemetry.file.file-size-limit-bytes

配置最大文件大小限制(以字节为单位)。

Example

dab configure \
  --runtime.telemetry.file.file-size-limit-bytes 2097152

生成的配置

{
  "runtime": {
    "telemetry": {
      "file": {
        "enabled": true,
        "path": "C:\\logs\\dab-log.txt",
        "rolling-interval": "Month",
        "retained-file-count-limit": 5,
        "file-size-limit-bytes": 2097152
      }
    }
  }
}

--help

显示此帮助屏幕。

Example

dab configure \
  --help

--version

显示版本信息。

Example

dab configure \
  --version