1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

pass versions through params

This commit is contained in:
Kyle Spearrin 2017-11-07 10:54:00 -05:00
parent 35ff3103a8
commit ccf5eec481
2 changed files with 25 additions and 8 deletions

View File

@ -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");
}
}
}

View File

@ -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();
}