mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 10:40:29 +01:00
75 lines
1.9 KiB
C#
75 lines
1.9 KiB
C#
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;
|
|
using StandardConfiguration;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
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;
|
|
}
|
|
|
|
public void LoadArgs(IConfiguration conf)
|
|
{
|
|
var networkInfo = DefaultConfiguration.GetNetwork(conf);
|
|
Network = networkInfo?.Network;
|
|
if (Network == null)
|
|
throw new ConfigException("Invalid network");
|
|
|
|
DataDir = conf.GetOrDefault<string>("datadir", networkInfo.DefaultDataDirectory);
|
|
Logs.Configuration.LogInformation("Network: " + Network);
|
|
|
|
Explorer = conf.GetOrDefault<Uri>("explorer.url", networkInfo.DefaultExplorerUrl);
|
|
CookieFile = conf.GetOrDefault<string>("explorer.cookiefile", networkInfo.DefaultExplorerCookieFile);
|
|
PostgresConnectionString = conf.GetOrDefault<string>("postgres", null);
|
|
ExternalUrl = conf.GetOrDefault<Uri>("externalurl", null);
|
|
InternalUrl = conf.GetOrDefault<Uri>("internalurl", null);
|
|
}
|
|
public string PostgresConnectionString
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
public Uri ExternalUrl
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
public Uri InternalUrl { get; private set; }
|
|
}
|
|
}
|