From 091f617e37c7eb47ace30d95db1ff26ea7313599 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Mon, 17 Nov 2025 22:59:15 +0700 Subject: [PATCH] Update configuration files for production, sandbox, and local environments. Changed Kaigen BaseUrl and database connection strings to point to new server addresses. Adjusted CORS allowed origins and authentication valid audiences for improved security and functionality. --- src/Managing.Api/appsettings.Production.json | 9 +++------ src/Managing.Api/appsettings.Sandbox.json | 11 +++++------ src/Managing.Api/appsettings.SandboxLocal.json | 4 ++-- src/Managing.Application/Bots/TradingBotBase.cs | 11 ++++------- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/Managing.Api/appsettings.Production.json b/src/Managing.Api/appsettings.Production.json index a0350b23..863fb9c3 100644 --- a/src/Managing.Api/appsettings.Production.json +++ b/src/Managing.Api/appsettings.Production.json @@ -24,7 +24,7 @@ } }, "Kaigen": { - "BaseUrl": "https://api.kaigen.managing.live", + "BaseUrl": "https://srv-captain--kaigen-back:3000", "DebitEndpoint": "/api/credits/debit", "RefundEndpoint": "/api/credits/refund" }, @@ -44,9 +44,7 @@ "Cors": { "AllowedOrigins": [ "https://app.kaigen.ai", - "https://api.kaigen.ai", - "https://web-ui.kai.managing.live", - "http://localhost:3000" + "https://web-ui.kai.managing.live" ] }, "Authentication": { @@ -55,8 +53,7 @@ "ValidIssuer": "https://api.kaigen.ai", "ValidAudiences": [ "https://app.kaigen.ai", - "https://web-ui.kai.managing.live", - "http://localhost:3000" + "https://web-ui.kai.managing.live" ] } } diff --git a/src/Managing.Api/appsettings.Sandbox.json b/src/Managing.Api/appsettings.Sandbox.json index 08630ec0..6ae20ad6 100644 --- a/src/Managing.Api/appsettings.Sandbox.json +++ b/src/Managing.Api/appsettings.Sandbox.json @@ -1,7 +1,7 @@ { "PostgreSql": { - "ConnectionString": "Host=srv-captain--managing-postgre;Port=5432;Database=managing;Username=postgres;Password=29032b13a5bc4d37", - "Orleans": "Host=srv-captain--managing-postgre;Port=5432;Database=orleans;Username=postgres;Password=29032b13a5bc4d37" + "ConnectionString": "Host=srv-captain--db;Port=5432;Database=managing;Username=postgres;Password=28d7c07e72296e08", + "Orleans": "Host=srv-captain--db;Port=5432;Database=orleans;Username=postgres;Password=28d7c07e72296e08" }, "InfluxDb": { "Url": "http://srv-captain--influx-db:8086/", @@ -9,7 +9,7 @@ "Token": "zODh8Hn8sN5VwpVJH0HAwDpCJPE4oB5IUg8L4Q0T67KM1Rta6PoM0nATUzf1ddkyWx_VledooZXfFIddahbL9Q==" }, "Kaigen": { - "BaseUrl": "https://kaigen-back-kaigen-stage.up.railway.app", + "BaseUrl": "https://srv-captain--kaigen-back:3000", "DebitEndpoint": "/api/credits/debit", "RefundEndpoint": "/api/credits/refund" }, @@ -42,8 +42,7 @@ "AllowedHosts": "*", "Cors": { "AllowedOrigins": [ - "https://kaigen-web-kaigen-stage.up.railway.app", - "https://dev-managing-api.apps.managing.live", + "https://kaigen-web.apps.managing.live", "https://web-ui.kai.managing.live", "http://localhost:3000" ] @@ -53,7 +52,7 @@ "Bearer": { "ValidIssuer": "https://dev-managing-api.apps.managing.live", "ValidAudiences": [ - "https://kaigen-web-kaigen-stage.up.railway.app", + "https://kaigen-web.apps.managing.live", "https://web-ui.kai.managing.live", "http://localhost:3000" ] diff --git a/src/Managing.Api/appsettings.SandboxLocal.json b/src/Managing.Api/appsettings.SandboxLocal.json index c6537aa9..474c18da 100644 --- a/src/Managing.Api/appsettings.SandboxLocal.json +++ b/src/Managing.Api/appsettings.SandboxLocal.json @@ -1,7 +1,7 @@ { "PostgreSql": { - "ConnectionString": "Host=managing-postgre.apps.managing.live;Port=5432;Database=managing;Username=postgres;Password=29032b13a5bc4d37", - "Orleans": "Host=managing-postgre.apps.managing.live;Port=5432;Database=orleans;Username=postgres;Password=29032b13a5bc4d37" + "ConnectionString": "Host=db.apps.managing.live;Port=5432;Database=managing;Username=postgres;Password=28d7c07e72296e08", + "Orleans": "Host=db.apps.managing.live;Port=5432;Database=orleans;Username=postgres;Password=28d7c07e72296e08" }, "InfluxDb": { "Url": "https://influx-db.apps.managing.live", diff --git a/src/Managing.Application/Bots/TradingBotBase.cs b/src/Managing.Application/Bots/TradingBotBase.cs index a1d42916..389586c4 100644 --- a/src/Managing.Application/Bots/TradingBotBase.cs +++ b/src/Managing.Application/Bots/TradingBotBase.cs @@ -233,7 +233,7 @@ public class TradingBotBase : ITradingBot if (!Config.IsForBacktest) { await LoadLastCandle(); - + if (!Config.IsForCopyTrading) { await UpdateSignals(); @@ -615,7 +615,7 @@ public class TradingBotBase : ITradingBot { // Position not in history either - could be API issue or timing problem // Don't immediately close, just log warning and retry next cycle - await LogWarning( + await LogDebug( $"⚠️ Position Synchronization Warning\n" + $"Position `{internalPosition.Identifier}` ({internalPosition.OriginDirection} {Config.Ticker})\n" + $"Not found in broker positions OR exchange history\n" + @@ -625,10 +625,6 @@ public class TradingBotBase : ITradingBot $"• Timing issue with broker API\n" + $"• Position direction mismatch\n" + $"Will retry verification on next cycle before taking action"); - - // Don't change the position status yet - wait for next cycle to verify - await LogDebug( - $"Position {internalPosition.Identifier} will be rechecked on next bot cycle for broker synchronization"); } } } @@ -1248,7 +1244,8 @@ public class TradingBotBase : ITradingBot // Store the signal Signals[copySignal.Identifier] = copySignal; - await LogInformation($"📋 Copy trading: Created copy signal {copySignal.Identifier} for master position {masterPosition.Identifier}"); + await LogInformation( + $"📋 Copy trading: Created copy signal {copySignal.Identifier} for master position {masterPosition.Identifier}"); // Attempt to open the position using the existing OpenPosition method // This will handle all the position creation logic properly