Skip to content

Commit

Permalink
fix(connection): readOptionsFromEnv sets protocol
Browse files Browse the repository at this point in the history
This is needed to allow REST connections using
`http:` to override the default (`https:`).
  • Loading branch information
line-o committed Oct 18, 2023
1 parent 0cbcced commit 6993c4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function readOptionsFromEnv () {
environmentOptions.secure = protocol === 'https:'
environmentOptions.host = hostname
environmentOptions.port = port
environmentOptions.protocol = protocol
}

return environmentOptions
Expand Down
2 changes: 2 additions & 0 deletions spec/tests/readenv.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ test('connection options from environment', function (t) {
t.equal(optionsFromEnv.port, port)
t.equal(optionsFromEnv.secure, protocol === 'https:')
t.equal(optionsFromEnv.host, hostname)
t.equal(optionsFromEnv.protocol, protocol)
} else {
t.false('port' in optionsFromEnv)
t.false('secure' in optionsFromEnv)
t.false('host' in optionsFromEnv)
t.false('protocol' in optionsFromEnv)
}

if (userIsSet) {
Expand Down

0 comments on commit 6993c4b

Please sign in to comment.