pool_config.js 655 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const ConnectionConfig = require('./connection_config.js');
  3. class PoolConfig {
  4. constructor(options) {
  5. if (typeof options === 'string') {
  6. options = ConnectionConfig.parseUrl(options);
  7. }
  8. this.connectionConfig = new ConnectionConfig(options);
  9. this.waitForConnections =
  10. options.waitForConnections === undefined
  11. ? true
  12. : Boolean(options.waitForConnections);
  13. this.connectionLimit = isNaN(options.connectionLimit)
  14. ? 10
  15. : Number(options.connectionLimit);
  16. this.queueLimit = isNaN(options.queueLimit)
  17. ? 0
  18. : Number(options.queueLimit);
  19. }
  20. }
  21. module.exports = PoolConfig;