v0.3
This commit is contained in:
1 parent
28e39f7ce4
commit
b57beb83c7
34 files changed
+1037
-314
No files matched your search
+41
-2
@@ -312,8 +312,47 @@ async fn certificate_inventory(State(state): State<Arc<App>>) -> Json<Value> {
|
||||
json!({"revision":snapshot.envelope.revision,"certificates":entries,"acme":true, "providers":["http01", "cloudflare", "ovh", "rfc2136"]}),
|
||||
)
|
||||
}
|
||||
async fn configuration(State(state): State<Arc<App>>) -> Json<crate::config::Envelope> {
|
||||
Json(state.config.load().envelope.clone())
|
||||
// Storage metadata belongs to GET /api/config, not to the editable `config`
|
||||
// document or the revisioned envelopes returned by update/restore endpoints.
|
||||
#[derive(Serialize)]
|
||||
struct ConfigurationRead {
|
||||
#[serde(flatten)]
|
||||
envelope: crate::config::Envelope,
|
||||
storage: ConfigStorage,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct ConfigStorage {
|
||||
mode: &'static str,
|
||||
config_path: Option<String>,
|
||||
database_path: Option<String>,
|
||||
}
|
||||
|
||||
async fn configuration(State(state): State<Arc<App>>) -> Json<ConfigurationRead> {
|
||||
let envelope = state.config.load().envelope.clone();
|
||||
let config_path = state
|
||||
.config_file
|
||||
.lock()
|
||||
.await
|
||||
.as_ref()
|
||||
.map(|(path, _)| path.to_string_lossy().into_owned());
|
||||
let database_path = state
|
||||
.policy
|
||||
.data_dir
|
||||
.as_ref()
|
||||
.map(|dir| dir.join("config.sqlite3").to_string_lossy().into_owned());
|
||||
Json(ConfigurationRead {
|
||||
envelope,
|
||||
storage: ConfigStorage {
|
||||
mode: if config_path.is_some() {
|
||||
"file"
|
||||
} else {
|
||||
"sqlite"
|
||||
},
|
||||
config_path,
|
||||
database_path,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
||||
Reference in new issue
Block a user