- fix: fix runner path
This commit is contained in:
@@ -179,10 +179,12 @@ public partial class ServerEntryModelView : ViewModelBase
|
|||||||
|
|
||||||
await RunnerService.PrepareRun(buildInfo, loadingContext, CancellationService.Token);
|
await RunnerService.PrepareRun(buildInfo, loadingContext, CancellationService.Token);
|
||||||
|
|
||||||
|
var path = Path.GetDirectoryName(Environment.ProcessPath);
|
||||||
|
|
||||||
Process = Process.Start(new ProcessStartInfo
|
Process = Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "dotnet.exe",
|
FileName = "dotnet.exe",
|
||||||
Arguments = "./Nebula.Runner.dll",
|
Arguments = Path.Join(path, "Nebula.Runner.dll"),
|
||||||
Environment =
|
Environment =
|
||||||
{
|
{
|
||||||
{ "ROBUST_AUTH_USERID", authProv?.UserId.ToString() },
|
{ "ROBUST_AUTH_USERID", authProv?.UserId.ToString() },
|
||||||
|
|||||||
@@ -64,6 +64,34 @@ public class ConfigurationService
|
|||||||
_debugService.Log($"Using default value for config: {conVar.Name}");
|
_debugService.Log($"Using default value for config: {conVar.Name}");
|
||||||
return conVar.DefaultValue;
|
return conVar.DefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TryGetConfigValue<T>(ConVar<T> conVar,
|
||||||
|
[NotNullWhen(true)] out T? value)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(conVar);
|
||||||
|
value = default;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_fileService.ConfigurationApi.TryOpen(GetFileName(conVar), out var stream))
|
||||||
|
using (stream)
|
||||||
|
{
|
||||||
|
var obj = JsonSerializer.Deserialize<T>(stream);
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
_debugService.Log($"Successfully loaded config: {conVar.Name}");
|
||||||
|
value = obj;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_debugService.Error($"Error loading config for {conVar.Name}: {e.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
_debugService.Log($"Using default value for config: {conVar.Name}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetConfigValue<T>(ConVar<T> conVar, T value)
|
public void SetConfigValue<T>(ConVar<T> conVar, T value)
|
||||||
{
|
{
|
||||||
@@ -100,17 +128,4 @@ public class ConfigurationService
|
|||||||
{
|
{
|
||||||
return $"{conVar.Name}.json";
|
return $"{conVar.Name}.json";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static class ConfigExtensions
|
|
||||||
{
|
|
||||||
public static bool TryGetConfigValue<T>(this ConfigurationService configurationService, ConVar<T> conVar,
|
|
||||||
[NotNullWhen(true)] out T? value)
|
|
||||||
{
|
|
||||||
ArgumentNullException.ThrowIfNull(configurationService);
|
|
||||||
ArgumentNullException.ThrowIfNull(conVar);
|
|
||||||
|
|
||||||
value = configurationService.GetConfigValue(conVar);
|
|
||||||
return value != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user