-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use secrecy for more explicit usage of the access token
- Loading branch information
Showing
9 changed files
with
115 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
* Add better stats collection | ||
* Add support for detecting systemd notify socket to remove timestamp from logs | ||
* Use secrecy for access token | ||
* Deduplicate `from_x` code in ConfigValueBuilder | ||
* Add systemd sample configuration |
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
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
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
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
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,39 @@ | ||
use crate::types::ValueFromStr; | ||
use anyhow::Error; | ||
use secrecy::Secret; | ||
|
||
#[derive(Clone)] | ||
pub struct DigitalOceanToken(String); | ||
|
||
pub type SecretDigitalOceanToken = Secret<DigitalOceanToken>; | ||
|
||
impl DigitalOceanToken { | ||
pub fn as_str(&self) -> &str { | ||
self.0.as_str() | ||
} | ||
} | ||
|
||
impl secrecy::Zeroize for DigitalOceanToken { | ||
fn zeroize(&mut self) { | ||
self.0.zeroize(); | ||
} | ||
} | ||
|
||
impl secrecy::CloneableSecret for DigitalOceanToken {} | ||
impl secrecy::DebugSecret for DigitalOceanToken {} | ||
|
||
impl std::str::FromStr for DigitalOceanToken { | ||
type Err = Error; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
Ok(DigitalOceanToken(s.to_owned())) | ||
} | ||
} | ||
|
||
impl ValueFromStr for Secret<DigitalOceanToken> { | ||
type Err = Error; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
Ok(Secret::new(s.parse::<DigitalOceanToken>()?)) | ||
} | ||
} |
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