make get_index and ApiConfig property (callback)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
f533d16ef6
commit
7fa9a37c7c
@ -1,5 +1,9 @@
|
||||
use anyhow::{bail, Error};
|
||||
use futures::*;
|
||||
use http::request::Parts;
|
||||
use http::Response;
|
||||
use hyper::{Body, StatusCode};
|
||||
use hyper::header;
|
||||
|
||||
use proxmox::try_block;
|
||||
use proxmox::api::RpcEnvironmentType;
|
||||
@ -27,6 +31,22 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_index(
|
||||
_auth_id: Option<String>,
|
||||
_language: Option<String>,
|
||||
_api: &ApiConfig,
|
||||
_parts: Parts,
|
||||
) -> Response<Body> {
|
||||
|
||||
let index = "<center><h1>Proxmox Backup API Server</h1></center>";
|
||||
|
||||
Response::builder()
|
||||
.status(StatusCode::OK)
|
||||
.header(header::CONTENT_TYPE, "text/html")
|
||||
.body(index.into())
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
async fn run() -> Result<(), Error> {
|
||||
if let Err(err) = syslog::init(
|
||||
syslog::Facility::LOG_DAEMON,
|
||||
@ -65,6 +85,7 @@ async fn run() -> Result<(), Error> {
|
||||
&proxmox_backup::api2::ROUTER,
|
||||
RpcEnvironmentType::PRIVILEGED,
|
||||
default_api_auth(),
|
||||
get_index,
|
||||
)?;
|
||||
|
||||
let backup_user = pbs_config::backup_user()?;
|
||||
|
Reference in New Issue
Block a user