Skip to content

Configuration rework - #811

Merged
arthurschreiber merged 2 commits into
masterfrom
arthur/stricter-config
Oct 26, 2018
Merged

arthurschreiber merged 2 commits into
masterfrom
arthur/stricter-config

Conversation

@arthurschreiber

@arthurschreiber arthurschreiber commented Oct 22, 2018 •

Copy link
Copy Markdown
Collaborator

BREAKING CHANGE: This drops support for previousl deprecated
configuration values and types, and makes the checks a lot stricter than
before.

Many configuration options no longer accept null values and instead
rely on values being present or undefined instead.

In other cases, configuration options that previously e.g. accepted
string values and automatically converted them to numbers now only
accept actual numbers.

Some options explicitly allow null values to be passed in and take
that as a hint to use whatever is configured on the SQL Server instead.


Another change included here is a rework of how authentication options are specified. Instead of having to specify authentication options via the top level userName, password and domain options, a new authentication sub object is added, which can hold the type of authentication to use (either default or ntlm right now). Additionally, each authentication type also takes a set of options.

new Connection({
  "server": "localhost",
  "userName": "sa",
  "password": "foobar"
});

// becomes

new Connection({
  "server": "localhost",
  "authentication": {
    "type": "default",
    "options": {
      "userName": "sa",
      "password": "foobar"
    }
  }
});

When config.authentication is not specified, tedious will still recognize the old config options, but will emit a deprecation warning.

This new configuration scheme for authentication will allow us to easily support other authentication types and their options, without having to add more and more top-level config options.


These changes are a pre-requisite to #707.

The changes in this pull request are pretty similar to #692, but updated to the latest changes that were made in the master branch. Thank you @Hadis-Fard for your work!

One thing I want to point out here is that I did not refactor these checks into re-usable functions, as keeping these checks inline will ensure that flow can actually understand their meaning, even though we don't really use flow to check the connection.js file yet. 🤷‍♂️

BREAKING CHANGE: This drops support for previousl deprecated 
configuration values and types, and makes the checks a lot stricter than 
before.

Many configuration options no longer accept `null` values and instead 
rely on values being present or `undefined` instead.

In other cases, configuration options that previously e.g. accepted 
string values and automatically converted them to numbers now only 
accept actual numbers.

Some options explicitly allow `null` values to be passed in and take 
that as a hint to use whatever is configured on the SQL Server instead.
@arthurschreiber
arthurschreiber requested a review from a team October 22, 2018 19:05
Comment thread src/connection.js Resolved
This new `config.autehntication` option allows specifying the 
authentication type to be used (`default` or `ntlm`, more to come soon) 
and takes a set of `options` for the specified type.

Existing `config.userName`, `config.password` and `config.domain` 
options will continue working for the time being, but will be removed in 
the future.
@arthurschreiber arthurschreiber changed the title Stricter configuration checking Configuration rework Oct 23, 2018
@Suraiya-Hameed

Copy link
Copy Markdown
Member

Thanks @arthurschreiber :) Can you update the github.io too or perhaps create an issue for now so we remember to do it later?

@arthurschreiber
arthurschreiber merged commit 7504a25 into master Oct 26, 2018
@arthurschreiber
arthurschreiber deleted the arthur/stricter-config branch October 26, 2018 21:44
@arthurschreiber

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants