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

Add support for specifying the WebSequenceDiagrams.com API key #9

Open
wants to merge 4 commits into
base: master
from

Conversation

@icedawn
Copy link

commented Mar 8, 2019

Added support for specifying the WebSequenceDiagrams.com API key on the command line or environment variable (WSD_APIKEY).

Added support for specifying the WebSequenceDiagrams.com API key on t…
…he command line or environment variable (WSD_APIKEY).
@coveralls

This comment has been minimized.

Copy link

commented Mar 8, 2019

Coverage Status

Coverage decreased (-1.07%) to 96.552% when pulling 5c6a4ed on icedawn:master into 711b273 on hildjj:master.

1 similar comment
@coveralls

This comment has been minimized.

Copy link

commented Mar 8, 2019

Coverage Status

Coverage decreased (-1.07%) to 96.552% when pulling 5c6a4ed on icedawn:master into 711b273 on hildjj:master.

@coveralls

This comment has been minimized.

Copy link

commented Mar 8, 2019

Coverage Status

Coverage decreased (-1.07%) to 96.552% when pulling f746e83 on icedawn:master into 711b273 on hildjj:master.

@hildjj
Copy link
Owner

left a comment

Please add a contributors section to the package.json and put yourself in it. Please add the apiKey to the README.md file. If they have a key that can be used for testing, please add a test.

lib/wsd.js Outdated
@@ -19,7 +19,7 @@ const styles = [
'patent']

class WSD {
static async diagramURL (message, style = 'default', format = 'png') {
static async diagramURL (message, style = 'default', format = 'png', apikey = '') {

This comment has been minimized.

Copy link
@hildjj

hildjj Mar 8, 2019

Owner

please use null instead of '' for the default.

This comment has been minimized.

Copy link
@icedawn

icedawn Mar 14, 2019

Author

Cool, got it.

.string('k')
.alias('k', 'key')
.describe('k', 'WebSequenceDiagrams API key. Key can also be specified with WSD_APIKEY environment variable. Requires premium account, see https://www.websequencediagrams.com/order.html')
.default('k', process.env.WSD_APIKEY)

This comment has been minimized.

Copy link
@hildjj

hildjj Mar 8, 2019

Owner

TODO: when we switch to yargs (see #10), think about their support for environment variables.

This comment has been minimized.

Copy link
@icedawn

icedawn Mar 14, 2019

Author

Excellent. Looks like yargs will handle this well. The WSD prefix seems appropriate. We'd have to choose whether the arg is "key" or "apikey" which would map to the environment variables WSD_KEY or WSD_APIKEY respectively. I'd lean towards "apikey" to be more descriptive.

This comment has been minimized.

Copy link
@hildjj

hildjj Mar 14, 2019

Owner

WSD_APIKEY feels just right.

@icedawn

This comment has been minimized.

Copy link
Author

commented Mar 14, 2019

I'll look into writing an appropriate unit test to check the API key path to get the coverage back up.

@icedawn

This comment has been minimized.

Copy link
Author

commented Mar 18, 2019

Still looking at adding unit tests for the new functionality and to get the code coverage back up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.