This commit is contained in:
35
Program.cs
35
Program.cs
@@ -53,21 +53,16 @@ catch (Exception ex)
|
|||||||
//ARGUMENTS DOC: https://www.postgresql.org/docs/11/app-postgres.html
|
//ARGUMENTS DOC: https://www.postgresql.org/docs/11/app-postgres.html
|
||||||
var PGProcess = new Process();
|
var PGProcess = new Process();
|
||||||
ProcessStartInfo PGStartInfo = new ProcessStartInfo(Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin", "pg_ctl.exe"));
|
ProcessStartInfo PGStartInfo = new ProcessStartInfo(Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin", "pg_ctl.exe"));
|
||||||
PGStartInfo.EnvironmentVariables["PGDATA"] = Path.Combine(DataPath, "database");
|
//NOTE: have to set log here in arguments, doesn't work as an environment variable, perhaps none of them work when starting this way
|
||||||
PGStartInfo.EnvironmentVariables["PGUSER"] = "postgres";
|
//so if anything is missing it probably needs to be added as a argument here
|
||||||
PGStartInfo.EnvironmentVariables["PGPORT"] = "5432";
|
//This is all because otherwise it logs to launcher console and messes up display as mixed in with ayanova server notices and also has misleading errors that don't apply
|
||||||
PGStartInfo.EnvironmentVariables["PGLOCALEDIR"] = Path.Combine(AyaNovaProgramFolder, "local-postgres", "share", "locale");
|
//like missing ayanova database which is about to be created anyway
|
||||||
PGStartInfo.EnvironmentVariables["PGLOGS "] = Path.Combine(DataPath, "logs","postgres.log");
|
PGStartInfo.Arguments = $"-D {Path.Combine(DataPath, "database")} -o \"-p 5432\" -l {Path.Combine(DataPath, "logs","postgres.log")} start";
|
||||||
PGStartInfo.Arguments = "start";
|
|
||||||
PGStartInfo.WorkingDirectory = Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin");
|
PGStartInfo.WorkingDirectory = Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin");
|
||||||
PGStartInfo.UseShellExecute = false;
|
PGStartInfo.UseShellExecute = false;
|
||||||
//PGStartInfo.RedirectStandardOutput = true;
|
|
||||||
PGProcess.StartInfo = PGStartInfo;
|
PGProcess.StartInfo = PGStartInfo;
|
||||||
//PGProcess.OutputDataReceived += new DataReceivedEventHandler(PostgresOutputHandler);
|
|
||||||
PGProcess.Start();
|
PGProcess.Start();
|
||||||
|
|
||||||
//PGProcess.BeginOutputReadLine();
|
|
||||||
|
|
||||||
|
|
||||||
//================== LAUNCH AYANOVA SERVER ==================
|
//================== LAUNCH AYANOVA SERVER ==================
|
||||||
var ServerProcess = new Process();
|
var ServerProcess = new Process();
|
||||||
@@ -117,11 +112,29 @@ static void AyaNovaOutputHandler(object sendingProcess, DataReceivedEventArgs ou
|
|||||||
|
|
||||||
// static void PostgresOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
|
// static void PostgresOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
|
||||||
// {
|
// {
|
||||||
// Console.WriteLine($"DB:{outLine.Data}");
|
|
||||||
|
// //File.AppendAllLines(outLine.Data);
|
||||||
|
// Console.WriteLine($"DB:{outLine.Data}");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// ####################### OLD ################################
|
// ####################### OLD ################################
|
||||||
|
|
||||||
|
|
||||||
|
//some env variables that are not working out with single window start, had to move them to arguments of process instead
|
||||||
|
// PGStartInfo.EnvironmentVariables["PGDATA"] = Path.Combine(DataPath, "database");
|
||||||
|
// 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","postgres.log");
|
||||||
|
// Console.WriteLine($"PG LOGS: {Path.Combine(DataPath, "logs","postgres.log")}");
|
||||||
|
//PGStartInfo.Arguments = "start";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This works but launches three windows
|
//This works but launches three windows
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user