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())