Skip to content

Conversation

tessus
Copy link
Collaborator

@tessus tessus commented Aug 19, 2023

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?

  • cargo test
  • fixtures
  • manual

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

- Deprecate `enabled` field in `random_url`

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tessus tessus requested a review from orhun as a code owner August 19, 2023 22:23
@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2023

Codecov Report

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

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

❗ 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
@@            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 Coverage Δ
unit-tests 70.15% <95.65%> (+0.68%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/main.rs 0.00% <0.00%> (ø)
src/server.rs 82.08% <ø> (ø)
src/config.rs 82.60% <100.00%> (+15.94%) ⬆️
src/paste.rs 85.34% <100.00%> (+0.38%) ⬆️
src/random.rs 83.33% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution once again! 💖

@orhun orhun merged commit d2d07ad into orhun:master Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config ergonomics for turning off random URLs
3 participants