From 75a3a12e5e3a45d1f8fe76c22e964f8d6979aa23 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 30 Nov 2021 20:19:15 +0000 Subject: [PATCH] --- Program.cs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Program.cs b/Program.cs index 177db1d..491b94b 100644 --- a/Program.cs +++ b/Program.cs @@ -48,22 +48,28 @@ catch (Exception ex) //================== LAUNCH POSTGRES SERVER ================== //https://notepad.onghu.com/2021/portable-postgresql-on-windows-without-installation/ -ProcessStartInfo PGStartInfo = new ProcessStartInfo(Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin") + "\\pg_ctl.exe"); -PGStartInfo.EnvironmentVariables["PGDATA"] = Path.Combine(DataPath, "database"); -//PGStartInfo.EnvironmentVariables["PGDATABASE"] = "AyaNova"; -PGStartInfo.EnvironmentVariables["PGUSER"] = "postgres"; -PGStartInfo.EnvironmentVariables["PGPORT"] = "5432"; -PGStartInfo.EnvironmentVariables["PGLOCALEDIR"] = Path.Combine(AyaNovaProgramFolder, "local-postgres", "share", "locale"); -PGStartInfo.EnvironmentVariables["PGLOGS "] = Path.Combine(DataPath, "logs"); -PGStartInfo.Arguments = "start"; -//PGStartInfo.FileName = "pg_ctl.exe"; -PGStartInfo.WorkingDirectory = Path.Combine(DataPath, "database"); -//PGStartInfo.WorkingDirectory = Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin"); -PGStartInfo.UseShellExecute = false; + + + +ProcessStartInfo PGStartInfo = new ProcessStartInfo(); +//PGStartInfo.EnvironmentVariables["PGDATA"] = Path.Combine(DataPath, "database"); +////PGStartInfo.EnvironmentVariables["PGDATABASE"] = "AyaNova"; +//PGStartInfo.EnvironmentVariables["PGUSER"] = "postgres"; +//PGStartInfo.EnvironmentVariables["PGPORT"] = "5432"; +//PGStartInfo.EnvironmentVariables["PGLOCALEDIR"] = Path.Combine(AyaNovaProgramFolder, "local-postgres", "share", "locale"); +//PGStartInfo.EnvironmentVariables["PGLOGS "] = Path.Combine(DataPath, "logs"); + +//ARGUMENTS DOC: https://www.postgresql.org/docs/11/app-postgres.html +PGStartInfo.Arguments = $"-D {Path.Combine(DataPath, "database")} -o \"-p 5432\" -l {Path.Combine(DataPath, "logs","postgres.log")} start"; +PGStartInfo.FileName = "pg_ctl.exe"; +//PGStartInfo.WorkingDirectory = Path.Combine(DataPath, "database"); +PGStartInfo.WorkingDirectory = Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin"); + +PGStartInfo.UseShellExecute = true; var PGProcess = Process.Start(PGStartInfo); -/* +/*"-D C:\ProgramData\ayanova\database -p 5432 -l C:\ProgramData\ayanova\logs start" old batch file settings required for postgres SET PATH="%~dp0postgres\bin";%PATH% SET PGDATA=%~dp0data\database