2017-09-13 08:47:34 +02:00
|
|
|
|
using BTCPayServer.Logging;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NBitcoin;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Text;
|
2017-09-22 18:31:29 +02:00
|
|
|
|
using StandardConfiguration;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2017-09-13 08:47:34 +02:00
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Configuration
|
|
|
|
|
{
|
|
|
|
|
public class BTCPayServerOptions
|
|
|
|
|
{
|
|
|
|
|
public Network Network
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
public Uri Explorer
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string CookieFile
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
public string ConfigurationFile
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
}
|
|
|
|
|
public string DataDir
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
}
|
|
|
|
|
public List<IPEndPoint> Listen
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-22 18:31:29 +02:00
|
|
|
|
public void LoadArgs(IConfiguration conf)
|
2017-09-13 08:47:34 +02:00
|
|
|
|
{
|
2017-09-22 18:31:29 +02:00
|
|
|
|
var networkInfo = DefaultConfiguration.GetNetwork(conf);
|
|
|
|
|
Network = networkInfo?.Network;
|
|
|
|
|
if(Network == null)
|
|
|
|
|
throw new ConfigException("Invalid network");
|
2017-09-13 08:47:34 +02:00
|
|
|
|
|
2017-09-22 18:31:29 +02:00
|
|
|
|
DataDir = conf.GetOrDefault<string>("datadir", networkInfo.DefaultDataDirectory);
|
2017-09-13 08:47:34 +02:00
|
|
|
|
Logs.Configuration.LogInformation("Network: " + Network);
|
|
|
|
|
|
2017-09-22 18:31:29 +02:00
|
|
|
|
Explorer = conf.GetOrDefault<Uri>("explorer.url", networkInfo.DefaultExplorerUrl);
|
|
|
|
|
CookieFile = conf.GetOrDefault<string>("explorer.cookiefile", networkInfo.DefaultExplorerCookieFile);
|
|
|
|
|
RequireHttps = conf.GetOrDefault<bool>("requirehttps", false);
|
2017-09-27 15:09:59 +02:00
|
|
|
|
PostgresConnectionString = conf.GetOrDefault<string>("postgres", null);
|
2017-09-15 12:25:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool RequireHttps
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
2017-09-13 08:47:34 +02:00
|
|
|
|
}
|
2017-09-27 15:09:59 +02:00
|
|
|
|
public string PostgresConnectionString
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
2017-09-13 08:47:34 +02:00
|
|
|
|
}
|
|
|
|
|
}
|