From ccf5eec481838fbdee0d06cf665c1fe5c929dde1 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 7 Nov 2017 10:54:00 -0500 Subject: [PATCH] pass versions through params --- util/Setup/DockerComposeBuilder.cs | 19 +++++++++++++------ util/Setup/Program.cs | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/util/Setup/DockerComposeBuilder.cs b/util/Setup/DockerComposeBuilder.cs index 4db5e8510..5e0180c1b 100644 --- a/util/Setup/DockerComposeBuilder.cs +++ b/util/Setup/DockerComposeBuilder.cs @@ -5,17 +5,25 @@ namespace Bit.Setup { public class DockerComposeBuilder { - private const string CoreVersion = "1.13.1"; - private const string WebVersion = "1.19.0"; - - public DockerComposeBuilder(string os) + public DockerComposeBuilder(string os, string webVersion, string coreVersion) { MssqlDataDockerVolume = os == "mac"; + + if(!string.IsNullOrWhiteSpace(webVersion)) + { + WebVersion = webVersion; + } + if(!string.IsNullOrWhiteSpace(coreVersion)) + { + CoreVersion = coreVersion; + } } public bool MssqlDataDockerVolume { get; private set; } public int HttpPort { get; private set; } = 80; public int HttpsPort { get; private set; } = 443; + public string CoreVersion { get; private set; } = "latest"; + public string WebVersion { get; private set; } = "latest"; public void BuildForInstaller(int httpPort, int httpsPort) { @@ -162,8 +170,7 @@ volumes: } // New line at end of file. - sw.Write(@" -"); + sw.Write("\n"); } } } diff --git a/util/Setup/Program.cs b/util/Setup/Program.cs index e4e57ce94..82d186756 100644 --- a/util/Setup/Program.cs +++ b/util/Setup/Program.cs @@ -15,6 +15,8 @@ namespace Bit.Setup private static Guid? _installationId = null; private static string _installationKey = null; private static string _hostOs = "win"; + private static string _coreVersion = "latest"; + private static string _webVersion = "latest"; public static void Main(string[] args) { @@ -24,6 +26,14 @@ namespace Bit.Setup { _hostOs = _parameters["os"]; } + if(_parameters.ContainsKey("corev")) + { + _coreVersion = _parameters["corev"]; + } + if(_parameters.ContainsKey("webv")) + { + _webVersion = _parameters["webv"]; + } if(_parameters.ContainsKey("install")) { @@ -125,7 +135,7 @@ namespace Bit.Setup var appIdBuilder = new AppIdBuilder(url); appIdBuilder.Build(); - var dockerComposeBuilder = new DockerComposeBuilder(_hostOs); + var dockerComposeBuilder = new DockerComposeBuilder(_hostOs, _webVersion, _coreVersion); dockerComposeBuilder.BuildForInstaller(httpPort, httpsPort); } @@ -271,7 +281,7 @@ namespace Bit.Setup var appIdBuilder = new AppIdBuilder(url); appIdBuilder.Build(); - var dockerComposeBuilder = new DockerComposeBuilder(_hostOs); + var dockerComposeBuilder = new DockerComposeBuilder(_hostOs, _webVersion, _coreVersion); dockerComposeBuilder.BuildForUpdater(); }