Browse Source

Support for reverse proxy in setup script (#139)

* Added option for when using reverse proxy to setup script

* Removed debug console.write
pull/184/head
Viktor Hansson 8 years ago committed by Kyle Spearrin
parent
commit
afd72b26eb
  1. 45
      util/Setup/Program.cs

45
util/Setup/Program.cs

@ -123,6 +123,51 @@ namespace Bit.Setup @@ -123,6 +123,51 @@ namespace Bit.Setup
}
}
Console.Write("(!) Is your installation behind a reverse proxy? (y/n): ");
var reverseProxy = Console.ReadLine().ToLowerInvariant() == "y";
if(reverseProxy)
{
Console.Write("(!) Do you use the default ports on your reverse proxy (80/443)? (y/n): ");
var proxyDefaultPorts = Console.ReadLine().ToLowerInvariant() == "y";
if(proxyDefaultPorts)
{
url = ssl ? $"https://{domain}" : $"http://{domain}";
}
else
{
int httpReversePort = default(int), httpsReversePort = default(int);
Console.Write("(!) HTTP port: ");
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpReversePort))
{
if(ssl)
{
Console.Write("(!) HTTPS port: ");
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpsReversePort))
{
if(httpsReversePort != 443)
{
url += (":" + httpsReversePort);
}
}
else
{
Console.WriteLine("Invalid HTTPS port.");
httpReversePort = httpsReversePort = default(int);
}
}
else if(httpReversePort != 80)
{
url += (":" + httpReversePort);
}
}
else
{
Console.WriteLine("Invalid HTTP port.");
}
}
}
Console.Write("(!) Do you want to use push notifications? (y/n): ");
var push = Console.ReadLine().ToLowerInvariant() == "y";

Loading…
Cancel
Save