forked from EllieBotDevs/elliebot
migrations, query fixes, fixes for mysql and postgres. In progress
This commit is contained in:
parent
b04768633c
commit
40b4ebf0fa
29 changed files with 18970 additions and 8070 deletions
src/EllieBot/Services/Impl
|
@ -1,6 +1,5 @@
|
|||
#nullable disable
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using EllieBot.Common.Yml;
|
||||
|
||||
namespace EllieBot.Services;
|
||||
|
@ -22,7 +21,6 @@ public sealed class BotCredsProvider : IBotCredsProvider
|
|||
|
||||
|
||||
private readonly object _reloadLock = new();
|
||||
private readonly IDisposable _changeToken;
|
||||
|
||||
public BotCredsProvider(int? totalShards = null, string credPath = null)
|
||||
{
|
||||
|
@ -49,18 +47,18 @@ public sealed class BotCredsProvider : IBotCredsProvider
|
|||
// this can fail in docker containers
|
||||
}
|
||||
|
||||
MigrateCredentials();
|
||||
|
||||
if (!File.Exists(CredsPath))
|
||||
{
|
||||
Log.Warning(
|
||||
"{CredsPath} is missing. Attempting to load creds from environment variables prefixed with 'EllieBot_'. Example is in {CredsExamplePath}",
|
||||
CredsPath,
|
||||
CredsExamplePath);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
MigrateCredentials();
|
||||
|
||||
if (!File.Exists(CredsPath))
|
||||
{
|
||||
Log.Warning(
|
||||
"{CredsPath} is missing. Attempting to load creds from environment variables prefixed with 'EllieBot_'. Example is in {CredsExamplePath}",
|
||||
CredsPath,
|
||||
CredsExamplePath);
|
||||
}
|
||||
|
||||
_config = new ConfigurationBuilder().AddYamlFile(CredsPath, false, true)
|
||||
.AddEnvironmentVariables("EllieBot_")
|
||||
.Build();
|
||||
|
@ -70,7 +68,6 @@ public sealed class BotCredsProvider : IBotCredsProvider
|
|||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
_changeToken = ChangeToken.OnChange(() => _config.GetReloadToken(), Reload);
|
||||
Reload();
|
||||
}
|
||||
|
||||
|
@ -141,6 +138,7 @@ public sealed class BotCredsProvider : IBotCredsProvider
|
|||
{
|
||||
creds.BotCache = BotCacheImplemenation.Redis;
|
||||
}
|
||||
|
||||
if (creds.Version <= 6)
|
||||
{
|
||||
creds.Version = 7;
|
||||
|
|
Reference in a new issue