feat(config): User must specify a directory to store data
Closes kemitix/git-next#55
This commit is contained in:
parent
704853017b
commit
16dc823f58
1 changed files with 13 additions and 0 deletions
|
@ -17,6 +17,7 @@ use crate::filesystem::FileSystem;
|
|||
#[derive(Debug, PartialEq, Eq, Deserialize)]
|
||||
pub struct ServerConfig {
|
||||
webhook: Webhook,
|
||||
storage: ServerStorage,
|
||||
forge: HashMap<String, ForgeConfig>,
|
||||
}
|
||||
impl ServerConfig {
|
||||
|
@ -56,6 +57,12 @@ impl AsRef<str> for WebhookUrl {
|
|||
}
|
||||
}
|
||||
|
||||
/// The directory to store server data, such as cloned repos
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
|
||||
pub struct ServerStorage {
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
/// Mapped from `.git-next.toml` file in target repo
|
||||
/// Is also derived from the optional parameters in `git-next-server.toml` at
|
||||
/// `forge.{forge}.repos.{repo}.(main|next|dev)`
|
||||
|
@ -394,6 +401,9 @@ mod tests {
|
|||
[webhook]
|
||||
url = "http://localhost:9909/webhook"
|
||||
|
||||
[storage]
|
||||
path = "/opt/git-next/data"
|
||||
|
||||
[forge.default]
|
||||
forge_type = "MockForge"
|
||||
hostname = "git.example.net"
|
||||
|
@ -418,6 +428,9 @@ mod tests {
|
|||
webhook: Webhook {
|
||||
url: "http://localhost:9909/webhook".to_string(),
|
||||
},
|
||||
storage: ServerStorage {
|
||||
path: "/opt/git-next/data".into(),
|
||||
},
|
||||
forge: HashMap::from([(
|
||||
"default".to_string(),
|
||||
ForgeConfig {
|
||||
|
|
Loading…
Reference in a new issue