This commit is contained in:
Christian Schwarz
2024-04-05 17:21:49 +02:00
parent 5cf45df692
commit 740efb0ab5
4 changed files with 7 additions and 23 deletions

View File

@@ -273,7 +273,7 @@ fn fill_remote_storage_secrets_vars(mut cmd: &mut Command) -> &mut Command {
fn fill_env_vars_prefixed_neon(mut cmd: &mut Command) -> &mut Command {
for (var, val) in std::env::vars() {
if var.starts_with("NEON_") {
if var.starts_with("NEON_PAGESERVER_") {
cmd = cmd.env(var, val);
}
}

View File

@@ -1,22 +1,6 @@
use std::{fmt::Display, str::FromStr};
//! Wrapper around `std::env::var` for parsing environment variables.
pub fn var_or_else<V, E, D>(varname: &str, default: D) -> V
where
V: FromStr<Err = E>,
E: Display,
D: FnOnce() -> V,
{
match std::env::var(varname) {
Ok(s) => s
.parse()
.map_err(|e| format!("failed to parse env var {varname}: {e:#}"))
.unwrap(),
Err(std::env::VarError::NotPresent) => default(),
Err(std::env::VarError::NotUnicode(_)) => {
panic!("env var {varname} is not unicode")
}
}
}
use std::{fmt::Display, str::FromStr};
pub fn var<V, E>(varname: &str) -> Option<V>
where

View File

@@ -26,7 +26,6 @@ pub mod auth;
// utility functions and helper traits for unified unique id generation/serialization etc.
pub mod id;
pub mod env_config;
mod hex;
pub use hex::Hex;
@@ -90,6 +89,8 @@ pub mod yielding_loop;
pub mod zstd;
pub mod env;
/// This is a shortcut to embed git sha into binaries and avoid copying the same build script to all packages
///
/// we have several cases:

View File

@@ -49,7 +49,7 @@ use tracing::{debug, error, info, warn};
use once_cell::sync::Lazy;
use utils::env_config;
use utils::env;
use utils::id::TimelineId;
//
@@ -146,7 +146,7 @@ impl FromStr for TokioRuntimeMode {
static ONE_RUNTIME: Lazy<Option<tokio::runtime::Runtime>> = Lazy::new(|| {
let thread_name = "pageserver worker";
let Some(mode) = env_config::var("NEON_PAGESERVER_USE_ONE_RUNTIME") else {
let Some(mode) = env::var("NEON_PAGESERVER_USE_ONE_RUNTIME") else {
// If the env var is not set, leave this static as None.
// The single_
return None;
@@ -199,7 +199,6 @@ macro_rules! pageserver_runtime {
pageserver_runtime!(COMPUTE_REQUEST_RUNTIME, "compute request worker");
pageserver_runtime!(MGMT_REQUEST_RUNTIME, "mgmt request worker");
pageserver_runtime!(WALRECEIVER_RUNTIME, "walreceiver worker");
// if you change the number of worker threads please change the constant below
pageserver_runtime!(BACKGROUND_RUNTIME, "background op worker");
#[derive(Debug, Clone, Copy)]