ccs: web: get settings for a single interface
This commit is contained in:
parent
edfc0373db
commit
ade01e4a91
1 changed files with 15 additions and 0 deletions
|
@ -53,6 +53,7 @@ pub fn rocket(state: ServerState) -> rocket::Rocket<rocket::Build> {
|
|||
primary_interface,
|
||||
interface,
|
||||
interface_full,
|
||||
interface_settings,
|
||||
get_control,
|
||||
enable_control,
|
||||
disable_control
|
||||
|
@ -155,6 +156,20 @@ async fn interface_full(
|
|||
Ok(Json(data.as_ref().ok_or(ServerError::NoData)?.clone()))
|
||||
}
|
||||
|
||||
#[get("/interface/<name>/settings")]
|
||||
async fn interface_settings(
|
||||
name: &str,
|
||||
state: &State<ServerState>,
|
||||
) -> Result<Json<crate::controller::ControllerSettings>, ServerError> {
|
||||
let data = state
|
||||
.data
|
||||
.get(name)
|
||||
.ok_or(ServerError::NotFound)?
|
||||
.read_settings()
|
||||
.await;
|
||||
Ok(Json(data.as_ref().ok_or(ServerError::NoData)?.clone()))
|
||||
}
|
||||
|
||||
#[get("/metrics")]
|
||||
fn metrics() -> Result<String, ServerError> {
|
||||
Ok(
|
||||
|
|
Loading…
Add table
Reference in a new issue