-
Notifications
You must be signed in to change notification settings - Fork 48
Overhaul tracker keys: allow permanent keys #983
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
Merged
josecelano
merged 2 commits into
torrust:develop
from
josecelano:979-overhaul-tracker-keys-allow-permanent-keys
Aug 1, 2024
Merged
Overhaul tracker keys: allow permanent keys #983
josecelano
merged 2 commits into
torrust:develop
from
josecelano:979-overhaul-tracker-keys-allow-permanent-keys
Aug 1, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We will add a new enpoint to add tracker keys where some JSON values can
be null:
```console
curl -X POST http://localhost:1212/api/v1/keys?token=MyAccessToken \
-H "Content-Type: application/json" \
-d '{
"key": null,
"seconds_valid": null
}'
```
We need to set those values to `None` in the Rsut strucut.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #983 +/- ##
===========================================
- Coverage 77.41% 76.89% -0.52%
===========================================
Files 184 184
Lines 9812 9916 +104
===========================================
+ Hits 7596 7625 +29
- Misses 2216 2291 +75 ☔ View full report in Codecov by Sentry. |
e1d2a4c to
2a438f0
Compare
2a438f0 to
cb565b4
Compare
9e04951 to
db9e2eb
Compare
db9e2eb to
6bcccd7
Compare
This commit adds a new feature. It allow creating permanent keys (keys
that do not expire).
THis is an example for making a request to the endpoint using curl:
```console
curl -X POST http://localhost:1212/api/v1/keys?token=MyAccessToken \
-H "Content-Type: application/json" \
-d '{
"key": null,
"seconds_valid": null
}'
```
NOTICE: both the `key` and the `seconds_valid` fields can be null.
- If `key` is `null` a new random key will be generated. You can use an
string with a pre-generated key like `Xc1L4PbQJSFGlrgSRZl8wxSFAuMa2110`. That will allow users to migrate to the Torrust Tracker wihtout forcing the users to re-start downloading/seeding with new keys.
- If `seconds_valid` is `null` the key will be permanent. Otherwise it
will expire after the seconds specified in this value.
6bcccd7 to
c5beff5
Compare
Member
Author
|
ACK c5beff5 |
Member
Author
|
Hi @da2ce7, this is ready for review. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new feature. Tracker keys can be permanent.
How to use the endpoint
Upload a pre-generated and expiring key
Upload a pre-generated and permanent key
Generate a random and expiring key
You can omit the key, and the tracker will generate a random one.
Generate a random and permanent key
NOTES
nullvalue to represent the case where the value is not needed. I prefer to use always the same structure and make it explicit. However, omitting the field could have other advantages, like requiring less maintenance. For example, if we rename a field (breaking change), that would not affect users who are not using that field.second_validcolumn in thekeystable is now nullable (for permanent keys).