git-next/crates/config/src/api_token.rs
Paul Campbell 341dc97a51
All checks were successful
Rust / build (push) Successful in 1m7s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
refactor(git): add mock repository and tests
Repository is now behind an enum to allow selection of a mock Repsitory
for use in tests.
2024-05-21 19:47:01 +01:00

16 lines
561 B
Rust

/// The API Token for the [user]
/// ForgeJo: https://{hostname}/user/settings/applications
/// Github: https://github.com/settings/tokens
#[derive(Clone, Debug, derive_more::Constructor)]
pub struct ApiToken(secrecy::Secret<String>);
/// The API Token is in effect a password, so it must be explicitly exposed to access its value
impl secrecy::ExposeSecret<String> for ApiToken {
fn expose_secret(&self) -> &String {
self.0.expose_secret()
}
}
impl Default for ApiToken {
fn default() -> Self {
Self("".to_string().into())
}
}