-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create new configuration v1 mod with figment
- Clone config strcuctures into a new mod `v1`. - Introduce versioning for configuration API. - Split config sections into submodules. TODO: - Still using root mod types in production. - Not using figment to build config in production.
- Loading branch information
1 parent
636e779
commit e7d344c
Showing
5 changed files
with
513 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_with::serde_as; | ||
|
||
/// Configuration for the Health Check API. | ||
#[serde_as] | ||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] | ||
pub struct HealthCheckApi { | ||
/// The address the API will bind to. | ||
/// The format is `ip:port`, for example `127.0.0.1:1313`. If you want to | ||
/// listen to all interfaces, use `0.0.0.0`. If you want the operating | ||
/// system to choose a random port, use port `0`. | ||
pub bind_address: String, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_with::{serde_as, NoneAsEmptyString}; | ||
|
||
/// Configuration for each HTTP tracker. | ||
#[serde_as] | ||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] | ||
pub struct HttpTracker { | ||
/// Weather the HTTP tracker is enabled or not. | ||
pub enabled: bool, | ||
/// The address the tracker will bind to. | ||
/// The format is `ip:port`, for example `0.0.0.0:6969`. If you want to | ||
/// listen to all interfaces, use `0.0.0.0`. If you want the operating | ||
/// system to choose a random port, use port `0`. | ||
pub bind_address: String, | ||
/// Weather the HTTP tracker will use SSL or not. | ||
pub ssl_enabled: bool, | ||
/// Path to the SSL certificate file. Only used if `ssl_enabled` is `true`. | ||
#[serde_as(as = "NoneAsEmptyString")] | ||
pub ssl_cert_path: Option<String>, | ||
/// Path to the SSL key file. Only used if `ssl_enabled` is `true`. | ||
#[serde_as(as = "NoneAsEmptyString")] | ||
pub ssl_key_path: Option<String>, | ||
} |
Oops, something went wrong.