This commit is contained in:
2021-11-30 20:19:15 +00:00
parent c6076d0f39
commit 75a3a12e5e

View File

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