This commit is contained in:
39
Program.cs
39
Program.cs
@@ -1,43 +1,10 @@
|
|||||||
global using System.Text.Json;
|
|
||||||
global using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
// Prevent from ending if CTL+C is pressed.
|
// Prevent from ending if CTL+C is pressed.
|
||||||
Console.TreatControlCAsInput = true;
|
Console.TreatControlCAsInput = true;
|
||||||
Console.WriteLine($"AyaNova server launcher {AyaNovaVersion.VersionString}");
|
Console.WriteLine($"AyaNova server launcher {AyaNovaVersion.VersionString}");
|
||||||
|
//================== LAUNCH AYANOVA SERVER ==================
|
||||||
|
|
||||||
AyConfig cfg = null;
|
var AyaNovaProcess = System.Diagnostics.Process.Start(@"../AyaNova.exe");
|
||||||
|
|
||||||
var ConfigFileName = @"config.json";
|
|
||||||
var json = string.Empty;
|
|
||||||
bool FirstTime=false;
|
|
||||||
//Read configuration or create if not exist
|
|
||||||
if (File.Exists(ConfigFileName))
|
|
||||||
{
|
|
||||||
json = File.ReadAllText(ConfigFileName);
|
|
||||||
cfg = JsonSerializer.Deserialize<AyConfig>(json);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cfg = new AyConfig();
|
|
||||||
FirstTime=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(FirstTime){
|
|
||||||
Console.WriteLine("Configuration file not found; using default values");
|
|
||||||
}
|
|
||||||
Console.WriteLine("Current configuration:");
|
|
||||||
|
|
||||||
//iterate / prompt for each value
|
|
||||||
|
|
||||||
|
|
||||||
//write configuration
|
|
||||||
cfg = new AyConfig();
|
|
||||||
json = JsonSerializer.Serialize(cfg);
|
|
||||||
File.WriteAllText(ConfigFileName, json);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("Press CTL-C keys to shut down AyaNova Server");
|
Console.WriteLine("Press CTL-C keys to shut down AyaNova Server");
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"AYANOVA_USE_URLS": "http://*:7575",
|
|
||||||
"AYANOVA_DB_CONNECTION":"Server=localhost;Username=postgres;Password=mypasswordforpostgres;Database=AyaNova;",
|
|
||||||
"AYANOVA_DEFAULT_TRANSLATION":"en",
|
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH":"postgres\\bin\\",
|
|
||||||
"AYANOVA_FOLDER_USER_FILES":"%programdata\\ayanova\\userfiles",
|
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES":"%programdata\\ayanova\\backupfiles",
|
|
||||||
"AYANOVA_LOG_PATH":"%programdata\\ayanova\\"
|
|
||||||
}
|
|
||||||
11
config.json
11
config.json
@@ -1 +1,10 @@
|
|||||||
{"AllowScheduleConflicts":true,"Test":"AyaNova server "}
|
{
|
||||||
|
"AYANOVA_USE_URLS": "http://*:7575",
|
||||||
|
"AYANOVA_DB_CONNECTION":"Server=localhost;Username=postgres;Password=mypasswordforpostgres;Database=AyaNova;",
|
||||||
|
"AYANOVA_DEFAULT_TRANSLATION":"en",
|
||||||
|
"AYANOVA_BACKUP_PG_DUMP_PATH":"postgres\\bin\\",
|
||||||
|
"AYANOVA_FOLDER_USER_FILES":"%programdata\\ayanova\\userfiles",
|
||||||
|
"AYANOVA_FOLDER_BACKUP_FILES":"%programdata\\ayanova\\backupfiles",
|
||||||
|
"AYANOVA_LOG_LEVEL": "Info",
|
||||||
|
"AYANOVA_LOG_PATH":"%programdata\\ayanova\\"
|
||||||
|
}
|
||||||
@@ -8,9 +8,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationIcon>ayanova.ico</ApplicationIcon>
|
<ApplicationIcon>ayanova.ico</ApplicationIcon>
|
||||||
<AssemblyName>ayanova-launcher</AssemblyName>
|
<AssemblyName>ayanova-launcher</AssemblyName>
|
||||||
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="appsettings.json">
|
<Content Include="config.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user