Skip to content

Settings coming along with url are ignored on 2.x #314

Closed
@robinbiondi

Description

@robinbiondi

Description/Steps to reproduce

When instantiating a Connector with settings including url and some other setting, the other settings are ignored.

Example of a test which wouldn't pass:

it('honours multiple user-defined settings', function() {
  var urlOnly = {url: newConfig(true).url, max: 999};
  var dataSource = new DataSource(connector, urlOnly);
  var pool = dataSource.connector.pg;
  
  pool.options.max.should.equal(999);
  var clientConfig = dataSource.connector.clientConfig;
  clientConfig.connectionString.should.equal(urlOnly.url);
});

Expected result

In this test, the max value in the pool should be 999 but it is at its default value of 10.

Additional information

I found where the problem come from:

https://github.com/strongloop/loopback-connector-postgresql/blob/eca1bb8fce8045e6a96d816ae218804fe51f8b6f/lib/postgresql.js#L75-L80

In the case of an url, the entire clientConfig is replaced by an object with only the URL key

I think this is a problem because in 3.x, this case is handled and included in tests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions