Tedious: 请使用最新的配置架构更新文档

创建于 2019-02-02  ·  5评论  ·  资料来源: tediousjs/tedious

这是我使用存储库中的示例得到的警告。

不推荐使用繁琐的“config.userName”属性已被弃用,未来的繁琐版本将不再支持它。 请改用新的“config.authentication”属性。 src/server/models/utilities/AzureSQL.js:36:25

请使用使用“config.authentication”的最新配置架构更新文档

最有用的评论

@pranaytanniru这是当前文档的一个缺点。

这是一个使用authentication属性的示例配置:

{
  "server": "localhost",
  "authentication": {
    "type": "default",
    "options": {
      "userName": "sa",
      "password": "yourStrong(!)Password",
    }
  },
  "options": {
    "port": 1433,
    "database": "master"
  }
}

所有5条评论

@yianni-ververis 有关新配置选项的文档已在http://tediousjs.github.io/tedious/api-connection.html中更新,欢迎任何反馈以使其变得更好🙏

嘿,没有关于配置对象应该是什么样子的示例。

@pranaytanniru这是当前文档的一个缺点。

这是一个使用authentication属性的示例配置:

{
  "server": "localhost",
  "authentication": {
    "type": "default",
    "options": {
      "userName": "sa",
      "password": "yourStrong(!)Password",
    }
  },
  "options": {
    "port": 1433,
    "database": "master"
  }
}

除了login failed for user ''之外,我没有收到任何错误消息

我使用的是 Typescript,结果发现@types/tedious定义已过时,并且没有包含身份验证对象的接口定义。 我已经向DefinitelyTyped项目提交了一个PR 来解决这个问题。

有关连接配置选项的完整列表,您可以查看 tedious/src/connection.js 下设置配置对象的构造函数。

例如,

const authentication = {
        type: 'default',
        options: {
          userName: ...,
          password: ...
        }
      };

const config = {
      server: config.server,
      authentication: authentication,
      options: {
        abortTransactionOnError: false,
        appName: undefined,
        camelCaseColumns: false,
        cancelTimeout: DEFAULT_CANCEL_TIMEOUT,
        columnNameReplacer: undefined,
        connectionRetryInterval: DEFAULT_CONNECT_RETRY_INTERVAL,
        connectTimeout: DEFAULT_CONNECT_TIMEOUT,
        connectionIsolationLevel: ISOLATION_LEVEL.READ_COMMITTED,
        cryptoCredentialsDetails: {},
        database: undefined,
        datefirst: DEFAULT_DATEFIRST,
        dateFormat: DEFAULT_DATEFORMAT,
        debug: {
          data: false,
          packet: false,
          payload: false,
          token: false
        },
        enableAnsiNull: true,
        enableAnsiNullDefault: true,
        enableAnsiPadding: true,
        enableAnsiWarnings: true,
        enableArithAbort: false,
        enableConcatNullYieldsNull: true,
        enableCursorCloseOnCommit: null,
        enableImplicitTransactions: false,
        enableNumericRoundabort: false,
        enableQuotedIdentifier: true,
        encrypt: false,
        fallbackToDefaultDb: false,
        instanceName: undefined,
        isolationLevel: ISOLATION_LEVEL.READ_COMMITTED,
        language: DEFAULT_LANGUAGE,
        localAddress: undefined,
        maxRetriesOnTransientErrors: 3,
        multiSubnetFailover: false,
        packetSize: DEFAULT_PACKET_SIZE,
        port: DEFAULT_PORT,
        readOnlyIntent: false,
        requestTimeout: DEFAULT_CLIENT_REQUEST_TIMEOUT,
        rowCollectionOnDone: false,
        rowCollectionOnRequestCompletion: false,
        tdsVersion: DEFAULT_TDS_VERSION,
        textsize: DEFAULT_TEXTSIZE,
        trustServerCertificate: true,
        useColumnNames: false,
        useUTC: true
      }
    };
此页面是否有帮助?
0 / 5 - 0 等级