openid: conditionally disable api endpoint

since it pulls in lots of additional linked libraries for all binaries
compiled as part of proxmox-backup. it can easily be re-enabled with
`--cfg openid` added to the RUSTFLAGS env variable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-07-01 14:58:33 +02:00 committed by Thomas Lamprecht
parent 26a3450f19
commit c2e2078b3f

View File

@ -26,6 +26,8 @@ pub mod domain;
pub mod role; pub mod role;
pub mod tfa; pub mod tfa;
pub mod user; pub mod user;
#[cfg(openid)]
pub mod openid; pub mod openid;
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
@ -415,6 +417,12 @@ pub fn list_permissions(
Ok(map) Ok(map)
} }
#[cfg(openid)]
const OPENID_ROUTER: &Router = &openid::ROUTER;
#[cfg(not(openid))]
const OPENID_ROUTER: &Router = &Router::new();
#[sortable] #[sortable]
const SUBDIRS: SubdirMap = &sorted!([ const SUBDIRS: SubdirMap = &sorted!([
("acl", &acl::ROUTER), ("acl", &acl::ROUTER),
@ -424,7 +432,7 @@ const SUBDIRS: SubdirMap = &sorted!([
&Router::new().get(&API_METHOD_LIST_PERMISSIONS) &Router::new().get(&API_METHOD_LIST_PERMISSIONS)
), ),
("ticket", &Router::new().post(&API_METHOD_CREATE_TICKET)), ("ticket", &Router::new().post(&API_METHOD_CREATE_TICKET)),
("openid", &openid::ROUTER), ("openid", &OPENID_ROUTER),
("domains", &domain::ROUTER), ("domains", &domain::ROUTER),
("roles", &role::ROUTER), ("roles", &role::ROUTER),
("users", &user::ROUTER), ("users", &user::ROUTER),