Started implementing server installation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MoonCore.Exceptions;
|
||||
using MoonCore.Extended.Abstractions;
|
||||
using MoonCore.Models;
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
@@ -96,4 +97,23 @@ public class RemoteServersController : Controller
|
||||
TotalPages = total == 0 ? 0 : total / pageSize
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet("{id:int}/install")]
|
||||
public async Task<ServerInstallDataResponse> GetInstall([FromRoute] int id)
|
||||
{
|
||||
var server = await ServerRepository
|
||||
.Get()
|
||||
.Include(x => x.Star)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
if (server == null)
|
||||
throw new HttpApiException("No server with this id found", 404);
|
||||
|
||||
return new ServerInstallDataResponse()
|
||||
{
|
||||
Script = server.Star.InstallScript,
|
||||
DockerImage = server.Star.InstallDockerImage,
|
||||
Shell = server.Star.InstallShell
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -380,6 +380,7 @@ public class StarImportExportService
|
||||
|
||||
// Fix up special variables
|
||||
entry.Value = entry.Value.Replace("server.allocations.default.port", "SERVER_PORT");
|
||||
entry.Value = entry.Value.Replace("server.build.default.port", "SERVER_PORT");
|
||||
|
||||
pc.Entries.Add(entry);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user