1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-22 21:51:22 +01:00

set proper port bindings for alternate port setup

This commit is contained in:
Kyle Spearrin 2018-03-28 11:03:20 -04:00
parent 7f250a4e74
commit 6f708a8198
2 changed files with 26 additions and 8 deletions

View File

@ -21,15 +21,19 @@ namespace Bit.Setup
public bool MssqlDataDockerVolume { get; private set; }
public int HttpPort { get; private set; } = 80;
public int HttpsPort { get; private set; } = 443;
public int HttpsPort { get; private set; }
public string CoreVersion { get; private set; } = "latest";
public string WebVersion { get; private set; } = "latest";
public void BuildForInstaller(int httpPort, int httpsPort)
{
if(httpPort != default(int) && httpsPort != default(int))
if(httpPort != default(int))
{
HttpPort = httpPort;
}
if(httpsPort != default(int))
{
HttpsPort = httpsPort;
}
@ -179,8 +183,15 @@ services:
container_name: bitwarden-nginx
restart: always
ports:
- '{HttpPort}:8080'
- '{HttpsPort}:8081'
- '{HttpPort}:8080'");
if(HttpsPort != default(int))
{
sw.Write($@"
- '{HttpsPort}:8081'");
}
sw.Write($@"
volumes:
- ../nginx:/etc/bitwarden/nginx
- ../letsencrypt:/etc/letsencrypt

View File

@ -91,7 +91,12 @@ namespace Bit.Setup
Console.Write("(!) Do you want to use the default ports for HTTP (80) and HTTPS (443)? (y/n): ");
var defaultPorts = Console.ReadLine().ToLowerInvariant() == "y";
int httpPort = default(int), httpsPort = default(int);
if(!defaultPorts)
if(defaultPorts)
{
httpPort = 80;
httpsPort = 443;
}
else
{
Console.Write("(!) HTTP port: ");
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpPort))
@ -108,8 +113,9 @@ namespace Bit.Setup
}
else
{
Console.WriteLine("Invalid HTTPS port.");
httpPort = httpsPort = default(int);
Console.WriteLine("Invalid HTTPS port. Using defaults.");
httpPort = 80;
httpsPort = 443;
}
}
else if(httpPort != 80)
@ -119,7 +125,8 @@ namespace Bit.Setup
}
else
{
Console.WriteLine("Invalid HTTP port.");
Console.WriteLine("Invalid HTTP port. Using default.")
httpPort = 80;
}
}