mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-27 01:50:38 +00:00
expose lakebase-v1 as a flag
This commit is contained in:
@@ -5,9 +5,7 @@ use std::pin::pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
use anyhow::Context;
|
||||
use anyhow::{bail, ensure};
|
||||
use anyhow::{Context, bail, ensure};
|
||||
use arc_swap::ArcSwapOption;
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
use camino::Utf8PathBuf;
|
||||
@@ -39,6 +37,7 @@ use crate::config::{
|
||||
ProxyConfig, ProxyProtocolV2, remote_storage_from_toml,
|
||||
};
|
||||
use crate::context::parquet::ParquetUploadArgs;
|
||||
use crate::control_plane::client::lakebase_v1::LakebaseClient;
|
||||
use crate::http::health_server::AppMetrics;
|
||||
use crate::metrics::{Metrics, ServiceInfo};
|
||||
use crate::rate_limiter::{EndpointRateLimiter, RateBucketInfo, WakeComputeRateLimiter};
|
||||
@@ -66,6 +65,9 @@ enum AuthBackendType {
|
||||
#[clap(alias("cplane-v1"))]
|
||||
ControlPlane,
|
||||
|
||||
#[clap(alias("lakebase-v1"))]
|
||||
Lakebase,
|
||||
|
||||
#[clap(alias("link"))]
|
||||
ConsoleRedirect,
|
||||
|
||||
@@ -734,6 +736,7 @@ fn build_config(args: &ProxyCliArgs) -> anyhow::Result<&'static ProxyConfig> {
|
||||
|
||||
match &args.auth_backend {
|
||||
AuthBackendType::ControlPlane => {}
|
||||
AuthBackendType::Lakebase => {}
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
AuthBackendType::Postgres => {}
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
@@ -828,6 +831,19 @@ fn build_auth_backend(
|
||||
Ok(Either::Left(config))
|
||||
}
|
||||
|
||||
AuthBackendType::Lakebase => {
|
||||
let url: url::Url = args.auth_endpoint.parse()?;
|
||||
let namespace = url.host_str().context("missing hostname as namespace")?;
|
||||
let port = url.port().unwrap_or(5432);
|
||||
|
||||
let api = LakebaseClient::new(namespace.to_owned(), port);
|
||||
let api = control_plane::client::ControlPlaneClient::LakebaseV1(api);
|
||||
let auth_backend = auth::Backend::ControlPlane(MaybeOwned::Owned(api), ());
|
||||
let config = Box::leak(Box::new(auth_backend));
|
||||
|
||||
Ok(Either::Left(config))
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
AuthBackendType::Postgres => {
|
||||
let mut url: ApiUrl = args.auth_endpoint.parse()?;
|
||||
|
||||
Reference in New Issue
Block a user