Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate connection with port as number when using --generate-connections CLI arg #40

Merged

Conversation

silwalanish
Copy link
Member

Issue

The connections.sync-db.json generated using --generate-connections creates the connection with port as string while sync-db expect a number.

$ sync-db --generate-connections

Else it fails with the error:
Error: An error occurred: TypeError: The "config.options.port" property must be of type number.
For example,
Following env produces the connections below:
env

DB_CLIENT=mssql
DB_HOST=localhost
DB_PORT=1433
DB_USERNAME=user
DB_PASSWORD=Password@123
DB_NAME=db1
DB_ENCRYPTION=true

Actual connections.sync-db.json

{
  "connections": [
    {
      "client": "mssql",
      "host": "localhost",
      "port": "1433",
      "user": "user",
      "password": "Password@123",
      "database": "db1",
      "options": {
        "encrypt": "true"
      }
    }
  ]
}

Expected connections.sync-db.json

{
  "connections": [
    {
      "client": "mssql",
      "host": "localhost",
      "port": 1433,
      "user": "user",
      "password": "Password@123",
      "database": "db1",
      "options": {
        "encrypt": "true"
      }
    }
  ]
}

Fix

  • Cast DB_PORT to number when generating connection from env

@codecov-io
Copy link

Codecov Report

Merging #40 into master will decrease coverage by 0.12%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #40      +/-   ##
=========================================
- Coverage   26.72%   26.6%   -0.13%     
=========================================
  Files          12      12              
  Lines         217     218       +1     
  Branches       15      16       +1     
=========================================
  Hits           58      58              
- Misses        158     159       +1     
  Partials        1       1
Impacted Files Coverage Δ
src/config.ts 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4249c55...c7b71c7. Read the comment docs.

@mesaugat mesaugat merged commit 2d36521 into leapfrogtechnology:master Feb 3, 2020
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.

3 participants