This commit is contained in:
33
Program.cs
33
Program.cs
@@ -53,21 +53,16 @@ catch (Exception ex)
|
||||
//ARGUMENTS DOC: https://www.postgresql.org/docs/11/app-postgres.html
|
||||
var PGProcess = new Process();
|
||||
ProcessStartInfo PGStartInfo = new ProcessStartInfo(Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin", "pg_ctl.exe"));
|
||||
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");
|
||||
PGStartInfo.Arguments = "start";
|
||||
//NOTE: have to set log here in arguments, doesn't work as an environment variable, perhaps none of them work when starting this way
|
||||
//so if anything is missing it probably needs to be added as a argument here
|
||||
//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
|
||||
//like missing ayanova database which is about to be created anyway
|
||||
PGStartInfo.Arguments = $"-D {Path.Combine(DataPath, "database")} -o \"-p 5432\" -l {Path.Combine(DataPath, "logs","postgres.log")} start";
|
||||
PGStartInfo.WorkingDirectory = Path.Combine(AyaNovaProgramFolder, "local-postgres", "bin");
|
||||
PGStartInfo.UseShellExecute = false;
|
||||
//PGStartInfo.RedirectStandardOutput = true;
|
||||
PGProcess.StartInfo = PGStartInfo;
|
||||
//PGProcess.OutputDataReceived += new DataReceivedEventHandler(PostgresOutputHandler);
|
||||
PGProcess.Start();
|
||||
|
||||
//PGProcess.BeginOutputReadLine();
|
||||
|
||||
|
||||
//================== LAUNCH AYANOVA SERVER ==================
|
||||
var ServerProcess = new Process();
|
||||
@@ -117,11 +112,29 @@ static void AyaNovaOutputHandler(object sendingProcess, DataReceivedEventArgs ou
|
||||
|
||||
// static void PostgresOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
|
||||
// {
|
||||
|
||||
// //File.AppendAllLines(outLine.Data);
|
||||
// Console.WriteLine($"DB:{outLine.Data}");
|
||||
// }
|
||||
|
||||
// ####################### 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
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user