Include VK_SHARED_API_BASE in prod builds (#1288)
This commit is contained in:
@@ -132,8 +132,12 @@ impl Deployment for LocalDeployment {
|
|||||||
let profile_cache = Arc::new(RwLock::new(None));
|
let profile_cache = Arc::new(RwLock::new(None));
|
||||||
let auth_context = AuthContext::new(oauth_credentials.clone(), profile_cache.clone());
|
let auth_context = AuthContext::new(oauth_credentials.clone(), profile_cache.clone());
|
||||||
|
|
||||||
let remote_client = match std::env::var("VK_SHARED_API_BASE") {
|
let api_base = option_env!("VK_SHARED_API_BASE")
|
||||||
Ok(url) => match RemoteClient::new(&url, auth_context.clone()) {
|
.map(|s| s.to_string())
|
||||||
|
.or_else(|| std::env::var("VK_SHARED_API_BASE").ok());
|
||||||
|
|
||||||
|
let remote_client = match api_base {
|
||||||
|
Some(url) => match RemoteClient::new(&url, auth_context.clone()) {
|
||||||
Ok(client) => {
|
Ok(client) => {
|
||||||
tracing::info!("Remote client initialized with URL: {}", url);
|
tracing::info!("Remote client initialized with URL: {}", url);
|
||||||
Ok(client)
|
Ok(client)
|
||||||
@@ -143,7 +147,7 @@ impl Deployment for LocalDeployment {
|
|||||||
Err(RemoteClientNotConfigured)
|
Err(RemoteClientNotConfigured)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(_) => {
|
None => {
|
||||||
tracing::info!("VK_SHARED_API_BASE not set; remote features disabled");
|
tracing::info!("VK_SHARED_API_BASE not set; remote features disabled");
|
||||||
Err(RemoteClientNotConfigured)
|
Err(RemoteClientNotConfigured)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ pub struct ShareConfig {
|
|||||||
|
|
||||||
impl ShareConfig {
|
impl ShareConfig {
|
||||||
pub fn from_env() -> Option<Self> {
|
pub fn from_env() -> Option<Self> {
|
||||||
let raw_base = std::env::var("VK_SHARED_API_BASE").ok()?;
|
let raw_base = option_env!("VK_SHARED_API_BASE")
|
||||||
|
.map(|s| s.to_string())
|
||||||
|
.or_else(|| std::env::var("VK_SHARED_API_BASE").ok())?;
|
||||||
let api_base = Url::parse(raw_base.trim()).ok()?;
|
let api_base = Url::parse(raw_base.trim()).ok()?;
|
||||||
let websocket_base = derive_ws_url(api_base.clone()).ok()?;
|
let websocket_base = derive_ws_url(api_base.clone()).ok()?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user