Configure clone URL host via GlobalConfig
Adds a field to GlobalConfig (default: "quire.local") so the
clone URL in the repo sidebar is no longer hardcoded. The template
builds the URL from the configured host at render time.
diff --git a/quire-server/src/quire/mod.rs b/quire-server/src/quire/mod.rs
index 09f851a..15c5b28 100644
--- a/quire-server/src/quire/mod.rs
+++ b/quire-server/src/quire/mod.rs
@@ -28,6 +28,10 @@ pub struct GlobalConfig {
/// quire-ci's bootstrap URL.
#[serde(default = "default_port")]
pub port: u16,
+ /// Hostname used in the clone URL shown in the repo sidebar.
+ /// E.g. `"quire.local"` renders as `https://quire.local/{repo}.git`.
+ #[serde(default = "default_host")]
+ pub host: String,
/// CI configuration.
#[serde(default)]
pub ci: CiConfig,
@@ -39,6 +43,7 @@ impl Default for GlobalConfig {
sentry: None,
secrets: HashMap::new(),
port: default_port(),
+ host: default_host(),
ci: CiConfig::default(),
}
}
@@ -48,6 +53,10 @@ fn default_port() -> u16 {
3000
}
+fn default_host() -> String {
+ "quire".to_string()
+}
+
#[derive(serde::Deserialize, Debug, Default, Clone)]
pub struct CiConfig {
/// How the orchestrator dispatches CI runs. Defaults to shelling
diff --git a/quire-server/src/quire/web/handlers/repo.rs b/quire-server/src/quire/web/handlers/repo.rs
index fa603b0..a7ba2b7 100644
--- a/quire-server/src/quire/web/handlers/repo.rs
+++ b/quire-server/src/quire/web/handlers/repo.rs
@@ -55,6 +55,7 @@ pub async fn repo_home(
readme_html,
recent_runs,
recent_changes,
+ clone_host: quire.config.host.clone(),
};
Ok(render(&tmpl))
}
diff --git a/quire-server/src/quire/web/templates.rs b/quire-server/src/quire/web/templates.rs
index d193e9f..e3b9aea 100644
--- a/quire-server/src/quire/web/templates.rs
+++ b/quire-server/src/quire/web/templates.rs
@@ -342,6 +342,7 @@ pub struct RepoHomeTemplate {
pub recent_runs: Vec<RunListRow>,
pub recent_changes: Vec<ChangeRow>,
pub sections: Vec<SectionLink>,
+ pub clone_host: String,
}
impl RepoHomeTemplate {
@@ -362,6 +363,10 @@ impl RepoHomeTemplate {
.map(|r| r.state_class())
.unwrap_or("")
}
+
+ pub fn clone_url(&self) -> String {
+ format!("https://{}/{}.git", self.clone_host, self.repo)
+ }
}
pub struct HeadInfo {
diff --git a/quire-server/templates/repo_home.html b/quire-server/templates/repo_home.html
index c82cfcc..9fc8c2c 100644
--- a/quire-server/templates/repo_home.html
+++ b/quire-server/templates/repo_home.html
@@ -50,7 +50,7 @@
<div class="side-block">
<div class="side-block-title">Clone</div>
- <div class="clone-url">https://quire.local/{{ repo }}.git</div>
+ <div class="clone-url">{{ clone_url() }}</div>
</div>
{% if !recent_runs.is_empty() %}