Revert "Added configuration options for BtcPayServer https binding. (#360)"

This reverts commit 3ac37497ab.
This commit is contained in:
nicolas.dorier 2018-10-30 00:25:05 +09:00
parent 3ac37497ab
commit 63014231ab
5 changed files with 10 additions and 41 deletions

View file

@ -262,15 +262,5 @@ namespace BTCPayServer.Configuration
builder.Path = RootPath;
return builder.ToString();
}
public string HttpsCertificateFilePath // Certificate and key file (typically .pfx) to use when binding to HTTPS listener.
{
get;
set;
}
public string HttpsCertificateFilePassword // Password for certificate when binding to HTTPS listener.
{
get;
set;
}
}
}

View file

@ -37,8 +37,6 @@ namespace BTCPayServer.Configuration
}
else if (typeof(T) == typeof(string))
return (T)(object)str;
else if (typeof(T) == typeof(IPAddress))
return (T)(object)IPAddress.Parse(str);
else if (typeof(T) == typeof(IPEndPoint))
{
var separator = str.LastIndexOf(":", StringComparison.InvariantCulture);

View file

@ -106,8 +106,6 @@ namespace BTCPayServer.Configuration
builder.AppendLine("### Server settings ###");
builder.AppendLine("#port=" + defaultSettings.DefaultPort);
builder.AppendLine("#bind=127.0.0.1");
builder.AppendLine("#httpscertificatefilepath=devtest.pfx");
builder.AppendLine("#httpscertificatefilepassword=toto");
builder.AppendLine();
builder.AppendLine("### Database ###");
builder.AppendLine("#postgres=User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=myDataBase;");

View file

@ -118,33 +118,15 @@ namespace BTCPayServer.Hosting
b.AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
});
});
services.Configure<KestrelServerOptions>(kestrel =>
{
var networkType = DefaultConfiguration.GetNetworkType(Configuration);
var defaultSettings = BTCPayDefaultSettings.GetDefaultSettings(networkType);
var btcPaySettings = Configuration.Get<BTCPayServerOptions>();
var bind = Configuration.GetOrDefault<IPAddress>("bind", IPAddress.Loopback);
int port = Configuration.GetOrDefault<int>("port", defaultSettings.DefaultPort);
if (!String.IsNullOrEmpty(btcPaySettings.HttpsCertificateFilePath))
{
if (!File.Exists(btcPaySettings.HttpsCertificateFilePath))
{
// Note that by design this is a fatal error condition that will cause the process to exit.
throw new ApplicationException($"The https certificate file could not be found at {btcPaySettings.HttpsCertificateFilePath}.");
}
Logs.Configuration.LogInformation($"Https certificate file path {btcPaySettings.HttpsCertificateFilePath}.");
kestrel.Listen(bind, port, l =>
{
l.UseHttps(btcPaySettings.HttpsCertificateFilePath, btcPaySettings.HttpsCertificateFilePassword);
});
}
else
{
kestrel.Listen(bind, port);
}
});
// Needed to debug U2F for ledger support
//services.Configure<KestrelServerOptions>(kestrel =>
//{
// kestrel.Listen(IPAddress.Loopback, 5012, l =>
// {
// l.UseHttps("devtest.pfx", "toto");
// });
//});
}
public void Configure(

View file

@ -15,7 +15,8 @@
"ASPNETCORE_ENVIRONMENT": "Development",
"BTCPAY_CHAINS": "btc,ltc",
"BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver"
}
},
"applicationUrl": "http://127.0.0.1:14142/"
}
}
}