diff --git a/pageserver/src/bin/pageserver.rs b/pageserver/src/bin/pageserver.rs index 87b8354269..21d2d8e4fd 100644 --- a/pageserver/src/bin/pageserver.rs +++ b/pageserver/src/bin/pageserver.rs @@ -28,6 +28,8 @@ const DEFAULT_LISTEN_ADDR: &str = "127.0.0.1:64000"; const DEFAULT_GC_HORIZON: u64 = 64 * 1024 * 1024; const DEFAULT_GC_PERIOD: Duration = Duration::from_secs(100); +const DEFAULT_SUPERUSER: &str = "zenith_admin"; + /// String arguments that can be declared via CLI or config file #[derive(Serialize, Deserialize)] struct CfgFileParams { @@ -96,6 +98,8 @@ impl CfgFileParams { gc_horizon, gc_period, + superuser: String::from(DEFAULT_SUPERUSER), + workdir: PathBuf::from("."), pg_distrib_dir, diff --git a/pageserver/src/branches.rs b/pageserver/src/branches.rs index c92c711b21..9071a4adf1 100644 --- a/pageserver/src/branches.rs +++ b/pageserver/src/branches.rs @@ -65,6 +65,7 @@ pub fn init_repo(conf: &'static PageServerConf, repo_dir: &Path) -> Result<()> { let initdb_path = conf.pg_bin_dir().join("initdb"); let initdb_otput = Command::new(initdb_path) .args(&["-D", tmppath.to_str().unwrap()]) + .args(&["-U", &conf.superuser]) .arg("--no-instructions") .env_clear() .env("LD_LIBRARY_PATH", conf.pg_lib_dir().to_str().unwrap()) diff --git a/pageserver/src/lib.rs b/pageserver/src/lib.rs index d4cce49f9c..1dfa384760 100644 --- a/pageserver/src/lib.rs +++ b/pageserver/src/lib.rs @@ -29,6 +29,7 @@ pub struct PageServerConf { pub listen_addr: String, pub gc_horizon: u64, pub gc_period: Duration, + pub superuser: String, // Repository directory, relative to current working directory. // Normally, the page server changes the current working directory diff --git a/pageserver/src/repository.rs b/pageserver/src/repository.rs index fd47149327..c4b507c0f2 100644 --- a/pageserver/src/repository.rs +++ b/pageserver/src/repository.rs @@ -364,6 +364,7 @@ mod tests { gc_horizon: 64 * 1024 * 1024, gc_period: Duration::from_secs(10), listen_addr: "127.0.0.1:5430".to_string(), + superuser: "zenith_admin".to_string(), workdir: repo_dir, pg_distrib_dir: "".into(), };