mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-04 00:28:52 -04:00
Add test instructions
This commit is contained in:
parent
6fa6df981e
commit
fdc3c1b012
2 changed files with 27 additions and 3 deletions
|
@ -24,12 +24,19 @@ namespace DiscordChatExporter.Cli.Tests.Infra
|
|||
|
||||
private static readonly Lazy<bool> IsDiscordTokenBotLazy = new(() =>
|
||||
{
|
||||
// Default to true
|
||||
var fromEnvironment = Environment.GetEnvironmentVariable("DISCORD_TOKEN_BOT");
|
||||
if (string.IsNullOrWhiteSpace(fromEnvironment))
|
||||
if (!string.IsNullOrWhiteSpace(fromEnvironment))
|
||||
return string.Equals(fromEnvironment, "true", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
var secretFilePath = Path.Combine(
|
||||
Path.GetDirectoryName(typeof(Secrets).Assembly.Location) ?? Directory.GetCurrentDirectory(),
|
||||
"DiscordTokenBot.secret"
|
||||
);
|
||||
|
||||
if (File.Exists(secretFilePath))
|
||||
return true;
|
||||
|
||||
return string.Equals(fromEnvironment, "true", StringComparison.OrdinalIgnoreCase);
|
||||
return false;
|
||||
});
|
||||
|
||||
public static string DiscordToken => DiscordTokenLazy.Value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue