NBISweden / sda-cli

User command line interface for the SDA
GNU Affero General Public License v3.0
5 stars 1 forks source link

Upload files by supplying the token as an ENV or on the command line #447

Closed jbygdell closed 1 month ago

jbygdell commented 1 month ago

Related issue(s) and PR(s)
This PR closes #395 .

Description This enables uploading of files where the token is not in the config file but supplied on the command line (-accesToken) or as an ENV ACCESSTOKEN. Token priority order:

  1. Using the -accessToken flag
  2. From the ENV ACCESSTOKEN
  3. In the config file

How to test

codecov-commenter commented 1 month ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 39.17%. Comparing base (bcb5721) to head (c4d86c3).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #447 +/- ## ========================================== + Coverage 38.79% 39.17% +0.37% ========================================== Files 11 11 Lines 1915 1922 +7 ========================================== + Hits 743 753 +10 + Misses 1060 1058 -2 + Partials 112 111 -1 ``` | [Flag](https://app.codecov.io/gh/NBISweden/sda-cli/pull/447/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NBISweden) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/NBISweden/sda-cli/pull/447/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NBISweden) | `39.17% <100.00%> (+0.37%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NBISweden#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MalinAhlberg commented 1 month ago

Nice! I think it would be even nicer if the README was updated too, also if the precedence of the token was stated there. Further, if I don't provide any token at all, I get Error: could not parse token, reason: token contains an invalid number of segments. Would it make sense to add something more informative, like "No access token provided"..?

jbygdell commented 1 month ago

Nice! I think it would be even nicer if the README was updated too, also if the precedence of the token was stated there. Further, if I don't provide any token at all, I get Error: could not parse token, reason: token contains an invalid number of segments. Would it make sense to add something more informative, like "No access token provided"..?

That error comes directly from the CheckTokenExpiration function.

But a check if any token is supplied could probably fit somewhere.