ActiveCampaign / postmark-cli

The official CLI tool for Postmark
https://postmarkapp.com
MIT License
79 stars 9 forks source link

Server Token should be parameter upfront #7

Closed katlimruiz closed 5 years ago

katlimruiz commented 5 years ago

When I do postmark templates pull ., then the cli will ask for the server token, and it downloads the templates correctly.

Yet I think the CLI needs to be improved (and I could even consider this a bug since the statement is "to use this in CI/CD" :)).

Server token cannot ask for stdin since in a pipeline there is no user input, so it should be another parameter something like:

postmark templates pull . --server-token xxxx

if there is another way, let me know

thanks

atheken commented 5 years ago

Hi @katlimruiz - yes, we do intend for the CLI to be helpful in CI/CD situations.

To use it without exposing the tokens in your logs or hard-coding them, you can use environment variables as outlined here:

https://github.com/wildbit/postmark-cli/wiki/Authentication

Please let us know if that covers your use case.

katlimruiz commented 5 years ago

sorry, but it is very incomplete. What are the env variable names to use? etc.

On the other hand, the templates pull command also asks "Do you want to overwrite?" that should be a "--force" option like when pushing.

katlimruiz commented 5 years ago

my workaround:

(
call echo xxx
SLEEP 5
call echo y
)|postmark templates pull .

Yet definitely I hope you agree is ridiculous to do this when the best way would be to modify the cli.

I will try to do a PR for this, but for you it should be very easy and fast to accomplish.

NOTE: I hope if you are promoting this new tool, then you could turnover this very fast _=)

derekrushforth commented 5 years ago

Hey @katlimruiz,

The environment variable name for the templates command is POSTMARK_SERVER_TOKEN. This was accidentally removed from our documentation, we will add it back shortly.

We also provide a way to automatically overwrite your templates when pulling. e.g. postmark templates pull ./ --overwrite. Check out the documentation for more details.

katlimruiz commented 5 years ago

Thanks for the env name.

I might have overlooked the overwrite setting.

Thanks for the help.