Struct gitforge::forge::Config [−][src]
pub struct Config { pub token: Option<TokenConfig>, pub kind: Option<Kind>, pub host: String, pub _non_exhaustive: (), }
Expand description
Instructions for how to connect to a forge
Fields
token: Option<TokenConfig>
Access token (secret).
If left as None
, Config::forge()
will do the work
of load_default_token
.
kind: Option<Kind>
The kind of forge (ie, the protocol to speak).
Currently, None
is not supported. In the future omitting
kind
might result in auto-guessing from host
.
host: String
Hostname.
Eg, gitlab.com
, github.com
, salsa.debian.org
.
_non_exhaustive: ()
Do not specify this field. Instead, say ..Default::default()
.
New fields may be added and this will not be considered a semver break.
Implementations
Calculate the default path for finding a secret token.
On Unix this is ~/.config/gitforge/FORGE_EXAMPLE_ORG.KIND-token
where FORGE_EXAMPLE_ORG
is host
with dots replaced with
underscores.
Load the default token, updating this Config.
It is not normally necessary to call this, because Config::new()
will automatically laod and use the appropriate token anyway,
according to the same algorithm.
Arranges that self.token
is either Anonymous
or Value
,
by establishing a suitable default, and loading the token from
a file, as necessary.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Config
impl UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more