-
Notifications
You must be signed in to change notification settings - Fork 355
Fix error in capturing key/cert file path - connects to #367 #368
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
Conversation
lib/gateway/server.js
Outdated
| let domainCount = httpsConfig.tls.length; | ||
| let domainNames = []; | ||
|
|
||
| httpsConfig.tls.forEach(domainObj => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be collapsed to something like:
const domainNames = httpsConfig.tls
.map(Object.getOwnPropertyNames)
.reduce((a, b) => a.concat(b));It's throwing here when missing tls config.
@DrMegavolt I think you worked on this in the past. What behavior should we expect if no tls configuration exists? Should we log a warning? Exit with a config validation error? Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinswiber great code condensing suggestion.
CircleCI is showing quite a few errors and warnings with my pull request. Is this all caused by a disruption from this change?
Also, if no tls option is set in gateway.config.yml for https i.e.
https:
port: 9443then npm start silently fails to begin listening on the specified port allowing the process to continue with no error output.
Should an error be thrown in this file to make a developer aware of the potential bug?
| let domain = el; | ||
| let certPaths = httpsConfig.tls[el]; | ||
| let domainCount = httpsConfig.tls.length; | ||
| const domainNames = httpsConfig.tls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fails in Circle CI if not tls provided in https section. so additional check is needed (+test update to rm https section if it is not in use).
there is a variant TLS-PSK that does not need a certificate. And it seems to be not supported by node.js nodejs/node#6701
So until then certificates are required. And I would imaging throwing an error and preventing start would be a good option.
|
@DrMegavolt @kevinswiber |
|
@larryschirmer We can close this. No worries. Thanks for taking another stab at it! |
When opening an https connection I noticed that express-gateway/lib/gateway/server.js is having issues properly capturing the file path in the .yml.
The for in loop is trying to pull properties from
httpsConfig.tlswhen the object is defined as an arrayThe issue was resolved by looping through the
tlsarray and assigning each domain object tocertPaths.