proxmox-rest-server: pass owned RestEnvironment to get_index

This way we avoid pointers with lifetimes.
This commit is contained in:
Dietmar Maurer
2021-10-04 14:49:25 +02:00
parent 3483a3b3a1
commit 48176b0a77
6 changed files with 34 additions and 38 deletions

View File

@ -8,7 +8,7 @@ use lazy_static::lazy_static;
use proxmox::api::{api, router::SubdirMap, Router, RpcEnvironmentType, UserInformation};
use proxmox::list_subdirs_api_method;
use proxmox_rest_server::{ApiAuth, ApiConfig, AuthError, RestServer};
use proxmox_rest_server::{ApiAuth, ApiConfig, AuthError, RestServer, RestEnvironment};
// Create a Dummy User info and auth system
// Normally this would check and authenticate the user
struct DummyUserInfo;
@ -46,9 +46,7 @@ impl ApiAuth for DummyAuth {
// iow. what the user browses to
fn get_index<'a>(
_auth_id: Option<String>,
_language: Option<String>,
_api: &'a ApiConfig,
_env: RestEnvironment,
_parts: http::request::Parts,
) -> Pin<Box<dyn Future<Output = http::Response<hyper::Body>> + Send + 'a>> {
Box::pin(async move {