Remove credit have to be enable for owned keys

This commit is contained in:
2025-11-19 21:12:25 +07:00
parent c7adb687b8
commit 799b27b0a8

View File

@@ -45,12 +45,6 @@ public class KaigenService : IKaigenService
var creditsEnabledEnv = Environment.GetEnvironmentVariable("KAIGEN_CREDITS_ENABLED");
_creditsEnabled = !string.IsNullOrEmpty(creditsEnabledEnv) && creditsEnabledEnv.ToLower() == "true";
if (!_creditsEnabled)
{
_logger.LogInformation("Kaigen credits are disabled via KAIGEN_CREDITS_ENABLED environment variable");
return; // Skip secret key validation if credits are disabled
}
// Always read from environment variable for security
var envSecretKey = Environment.GetEnvironmentVariable("KAIGEN_SECRET_KEY");
if (!string.IsNullOrEmpty(envSecretKey))
@@ -59,7 +53,7 @@ public class KaigenService : IKaigenService
_logger.LogInformation("Using KAIGEN_SECRET_KEY from environment variable");
}
// Validate required settings only if credits are enabled
// Validate required settings
if (string.IsNullOrEmpty(_settings.SecretKey))
{
throw new InvalidOperationException(
@@ -172,14 +166,6 @@ public class KaigenService : IKaigenService
public async Task<OwnedKeysResponse> GetOwnedKeysAsync(User user)
{
// If credits are disabled, return empty response
if (!_creditsEnabled)
{
_logger.LogInformation("Credits disabled - returning empty owned keys for user {UserName}",
user.Name);
return new OwnedKeysResponse { Items = new List<OwnedKeyItem>(), Overall = 0 };
}
try
{
var walletAddress = GetUserWalletAddress(user);