Fixed issue when starting without any configuration data present.

This commit is contained in:
flash 2023-10-01 04:54:30 +02:00
parent a7a05f04bd
commit 03b3b6b0a3

View file

@ -124,12 +124,11 @@ namespace SharpChat {
const string mdb_config = @"mariadb.txt";
bool hasMDB = File.Exists(mdb_config);
string[] mdbCfg = File.Exists(mdb_config) ? File.ReadAllLines(mdb_config) : Array.Empty<string>();
sw.WriteLine();
sw.WriteLine("# MariaDB configuration");
if(!string.IsNullOrWhiteSpace(mdbCfg[0]))
if(mdbCfg.Length > 0)
sw.WriteLine($"mariadb:host {mdbCfg[0]}");
else
sw.WriteLine($"#mariadb:host <username>");