Use 'zenith_admin' as superuser name in initdb

This commit is contained in:
sharnoff
2021-07-19 22:52:24 -07:00
committed by Stas Kelvich
parent 0723d49e0b
commit c4b2bf7ebd
4 changed files with 7 additions and 0 deletions

View File

@@ -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,

View File

@@ -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())

View File

@@ -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

View File

@@ -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(),
};