feat(config): rename propery url as hostname
This commit is contained in:
parent
cb0a7f7cd7
commit
a3c52c7761
2 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
[forge.default]
|
[forge.default]
|
||||||
forge_type = "forgejo"
|
forge_type = "forgejo"
|
||||||
url = "https://git.example.net"
|
hostname = "git.example.net"
|
||||||
user = "git-next" # the user to perform actions as
|
user = "git-next" # the user to perform actions as
|
||||||
# API token for user?
|
# API token for user?
|
||||||
# path to private SSH key for user?
|
# path to private SSH key for user?
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::filesystem::FileSystem;
|
||||||
#[derive(Debug, PartialEq, Eq, Deserialize)]
|
#[derive(Debug, PartialEq, Eq, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
forge_type: ForgeType,
|
forge_type: ForgeType,
|
||||||
url: String,
|
hostname: String,
|
||||||
user: String,
|
user: String,
|
||||||
// API Token
|
// API Token
|
||||||
// Private SSH Key Path
|
// Private SSH Key Path
|
||||||
|
@ -29,8 +29,8 @@ impl Config {
|
||||||
pub const fn forge_type(&self) -> &ForgeType {
|
pub const fn forge_type(&self) -> &ForgeType {
|
||||||
&self.forge_type
|
&self.forge_type
|
||||||
}
|
}
|
||||||
pub fn url(&self) -> &str {
|
pub fn hostname(&self) -> &str {
|
||||||
self.url.as_str()
|
self.hostname.as_str()
|
||||||
}
|
}
|
||||||
pub fn user(&self) -> &str {
|
pub fn user(&self) -> &str {
|
||||||
self.user.as_str()
|
self.user.as_str()
|
||||||
|
@ -50,14 +50,14 @@ mod tests {
|
||||||
"git-next-server.toml",
|
"git-next-server.toml",
|
||||||
r#"
|
r#"
|
||||||
forge_type = "ForgeJo"
|
forge_type = "ForgeJo"
|
||||||
url = "https://forge.jo"
|
hostname = "git.example.net"
|
||||||
user = "Bob"
|
user = "Bob"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.map_err(OneOf::new)?;
|
.map_err(OneOf::new)?;
|
||||||
let config = Config::load(&fs)?;
|
let config = Config::load(&fs)?;
|
||||||
assert_eq!(config.forge_type(), &ForgeType::ForgeJo);
|
assert_eq!(config.forge_type(), &ForgeType::ForgeJo);
|
||||||
assert_eq!(config.url(), "https://forge.jo".to_string());
|
assert_eq!(config.hostname(), "git.example.net".to_string());
|
||||||
assert_eq!(config.user(), "Bob".to_string());
|
assert_eq!(config.user(), "Bob".to_string());
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue