Ability to load connection_uri from a file #1790

Open
Allinen wants to merge 4 commits from Allinen/continuwuity:main into main
First-time contributor

This pull request adds a new config option connection_uri_file, which does the same as connection_uri except loads it from a file. connection_uri is prioritized over the file.

Fixes: #1694

Pull request checklist:

  • This pull request targets the main branch, and the branch is named something other than
    main.
  • I have written an appropriate pull request title and my description is clear.
  • I understand I am responsible for the contents of this pull request.
  • I have followed the contributing guidelines:
This pull request adds a new config option `connection_uri_file`, which does the same as `connection_uri` except loads it from a file. `connection_uri` is prioritized over the file. Fixes: [#1694][issue] **Pull request checklist:** - [x] This pull request targets the `main` branch, and the branch is named something other than `main`. - [x] I have written an appropriate pull request title and my description is clear. - [x] I understand I am responsible for the contents of this pull request. - I have followed the [contributing guidelines][c1]: - [x] My contribution follows the [code style][c2], if applicable. - [x] I ran [pre-commit checks][c1pc] before opening/drafting this pull request. - [x] I have [tested my contribution][c1t] (or proof-read it for documentation-only changes) myself, if applicable. This includes ensuring code compiles. - [x] My commit messages follow the [commit message format][c1cm] and are descriptive. [issue]: https://forgejo.ellis.link/continuwuation/continuwuity/issues/1694 [c1]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md [c2]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/docs/development/code_style.mdx [c1pc]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#pre-commit-checks [c1t]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#running-tests-locally [c1cm]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#commit-messages
style: fix typo
Some checks failed
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 4s
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 10s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Checks / Prek / Check changed files (pull_request) Has been cancelled
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
1ce4d783f3
chore: added changelog.d
Some checks failed
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 31s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Checks / Prek / Check changed files (pull_request) Has been cancelled
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
b5b74bc083
ginger requested changes 2026-05-20 16:05:06 +00:00
Dismissed
@ -255,2 +255,4 @@
}
if config.smtp.as_ref().is_some_and(|f| {
f.connection_uri.is_none() && f.connection_uri_file.is_none()
Owner

These checks can use is_none_or(|v| v.is_empty())

These checks can use `is_none_or(|v| v.is_empty())`
@ -2311,0 +2311,4 @@
/// Same as `connection_uri`, except loaded from a file. If `connection_uri`
/// is defined, it is prioritized and `connection_uri_file` is ignored
pub connection_uri_file: Option<PathBuf>,
Owner

This should end in a period, and should state that the file is only read once when the server starts, similar to the docs for registration_token_file.

This should end in a period, and should state that the file is only read once when the server starts, similar to [the docs for `registration_token_file`](https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/ba2c123e820597067dc2e3e02dd1ff59b921e0a1/src/core/config/mod.rs#L636-L638).
@ -33,0 +27,4 @@
.as_ref()
.map(|config| -> Result<_> {
let connection_uri: String =
if let Some(uri) = &config.connection_uri {
Owner

nit: This would be more clear as a match where (None, None) => unreachable!()

nit: This would be more clear as a `match` where `(None, None) => unreachable!()`
refactor: cleaned up code
Some checks failed
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 30s
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Check changed files (pull_request) Successful in 6s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 29s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 50s
222e9a8c27
Author
First-time contributor

thank you for the feedback, I am fairly new to rust so this is valuable information.

This should end in a period

Should the formatter config not be modified to automagically do this if it is a requirement?

Regardless, I have made the requested changes (hopefully) in the correct way

thank you for the feedback, I am fairly new to rust so this is valuable information. > This should end in a period Should the formatter config not be modified to automagically do this if it is a requirement? Regardless, I have made the requested changes (hopefully) in the correct way
ginger approved these changes 2026-05-27 13:08:05 +00:00
Owner

@Allinen this has merge conflicts with main, those need to be resolved before this can be merged

@Allinen this has merge conflicts with main, those need to be resolved before this can be merged
Some checks failed
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 30s
Required
Details
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Check changed files (pull_request) Successful in 6s
Required
Details
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 29s
Required
Details
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 50s
Required
Details
This pull request has changes conflicting with the target branch.
  • src/core/config/check.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u main:Allinen-main
git switch Allinen-main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity!1790
No description provided.