mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-10 02:33:47 +00:00
Refactored .NET server start
In the dev and production environment gets the .NET server started by Rust. Also, the secret IPC key gets set by using a local env variable.
This commit is contained in:
2 files changed
+82
-39
No files matched your search
@@ -11,7 +11,13 @@ using System.Reflection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
#endif
|
||||
|
||||
var rustApiPort = args.Length > 0 ? args[0] : "5000";
|
||||
if(args.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Please provide the port of the runtime API.");
|
||||
return;
|
||||
}
|
||||
|
||||
var rustApiPort = args[0];
|
||||
using var rust = new Rust(rustApiPort);
|
||||
var appPort = await rust.GetAppPort();
|
||||
if(appPort == 0)
|
||||
@@ -20,6 +26,14 @@ if(appPort == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// Read the secret key for the IPC from the AI_STUDIO_SECRET_KEY environment variable:
|
||||
var secretKey = Environment.GetEnvironmentVariable("AI_STUDIO_SECRET_KEY");
|
||||
if(string.IsNullOrWhiteSpace(secretKey))
|
||||
{
|
||||
Console.WriteLine("The AI_STUDIO_SECRET_KEY environment variable is not set.");
|
||||
return;
|
||||
}
|
||||
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
builder.Services.AddMudServices(config =>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user