From 23644eb93f3841e5e13e6149fb10e81ae818eebf Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Wed, 7 Jun 2023 02:23:30 +0200 Subject: [PATCH] Added smart deploy node override option --- Moonlight/App/Services/SmartDeployService.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Moonlight/App/Services/SmartDeployService.cs b/Moonlight/App/Services/SmartDeployService.cs index 38d013a0..88f6ff84 100644 --- a/Moonlight/App/Services/SmartDeployService.cs +++ b/Moonlight/App/Services/SmartDeployService.cs @@ -9,21 +9,36 @@ public class SmartDeployService private readonly Repository CloudPanelRepository; private readonly WebSpaceService WebSpaceService; private readonly NodeService NodeService; + private readonly ConfigService ConfigService; public SmartDeployService( NodeRepository nodeRepository, NodeService nodeService, WebSpaceService webSpaceService, - Repository cloudPanelRepository) + Repository cloudPanelRepository, + ConfigService configService) { NodeRepository = nodeRepository; NodeService = nodeService; WebSpaceService = webSpaceService; CloudPanelRepository = cloudPanelRepository; + ConfigService = configService; } public async Task GetNode() { + var config = ConfigService + .GetSection("Moonlight") + .GetSection("SmartDeploy") + .GetSection("Server"); + + if (config.GetValue("EnableOverride")) + { + var nodeId = config.GetValue("OverrideNode"); + + return NodeRepository.Get().FirstOrDefault(x => x.Id == nodeId); + } + var data = new Dictionary(); foreach (var node in NodeRepository.Get().ToArray())