orhun / rustypaste

A minimal file upload/pastebin service.
https://blog.orhun.dev/blazingly-fast-file-sharing
MIT License
791 stars 47 forks source link

feat(server): improve random_url config handling #122

Closed tessus closed 1 year ago

tessus commented 1 year ago

Description

Currently, in order to turn random URL's off, you must have at least one random_url declaration with a type and enabled = false.

This PR makes the random_url config optional while deprecating the enabled field without breaking current configs.

Motivation and Context

Closes #121

How Has This Been Tested?

Changelog Entry

### Changed

- Make the `random_url` config optional

```toml
# enabled
random_url = { type = "petname", words = 2, separator = "-" }

# disabled 
# random_url = { type = "petname", words = 2, separator = "-" }

Deprecated

Types of Changes

Checklist:

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 95.65% and project coverage change: +0.68% :tada:

Comparison is base (679a264) 69.47% compared to head (09f7724) 70.15%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #122 +/- ## ========================================== + Coverage 69.47% 70.15% +0.68% ========================================== Files 11 11 Lines 557 563 +6 ========================================== + Hits 387 395 +8 + Misses 170 168 -2 ``` | [Flag](https://app.codecov.io/gh/orhun/rustypaste/pull/122/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z) | Coverage Δ | | |---|---|---| | [unit-tests](https://app.codecov.io/gh/orhun/rustypaste/pull/122/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z) | `70.15% <95.65%> (+0.68%)` | :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=Orhun+Parmaks%C4%B1z#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/orhun/rustypaste/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z) | Coverage Δ | | |---|---|---| | [src/main.rs](https://app.codecov.io/gh/orhun/rustypaste/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z#diff-c3JjL21haW4ucnM=) | `0.00% <0.00%> (ø)` | | | [src/server.rs](https://app.codecov.io/gh/orhun/rustypaste/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z#diff-c3JjL3NlcnZlci5ycw==) | `82.08% <ø> (ø)` | | | [src/config.rs](https://app.codecov.io/gh/orhun/rustypaste/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z#diff-c3JjL2NvbmZpZy5ycw==) | `82.60% <100.00%> (+15.94%)` | :arrow_up: | | [src/paste.rs](https://app.codecov.io/gh/orhun/rustypaste/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z#diff-c3JjL3Bhc3RlLnJz) | `85.34% <100.00%> (+0.38%)` | :arrow_up: | | [src/random.rs](https://app.codecov.io/gh/orhun/rustypaste/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Orhun+Parmaks%C4%B1z#diff-c3JjL3JhbmRvbS5ycw==) | `83.33% <100.00%> (ø)` | |

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