mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Redirect to Stores page if creating invoice before creating a store
This commit is contained in:
@@ -11,6 +11,8 @@ using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
namespace BTCPayServer
|
||||
{
|
||||
@@ -23,7 +25,9 @@ namespace BTCPayServer
|
||||
try
|
||||
{
|
||||
var conf = new BTCPayServerOptions();
|
||||
conf.LoadArgs(new TextFileConfiguration(args));
|
||||
var arguments = new TextFileConfiguration(args);
|
||||
arguments = LoadEnvironmentVariables(arguments);
|
||||
conf.LoadArgs(arguments);
|
||||
|
||||
host = new WebHostBuilder()
|
||||
.AddPayServer(conf)
|
||||
@@ -61,6 +65,27 @@ namespace BTCPayServer
|
||||
}
|
||||
}
|
||||
|
||||
private static TextFileConfiguration LoadEnvironmentVariables(TextFileConfiguration args)
|
||||
{
|
||||
var variables = Environment.GetEnvironmentVariables();
|
||||
List<string> values = new List<string>();
|
||||
foreach(DictionaryEntry variable in variables)
|
||||
{
|
||||
var key = (string)variable.Key;
|
||||
var value = (string)variable.Value;
|
||||
if(key.StartsWith("APPSETTING_", StringComparison.Ordinal))
|
||||
{
|
||||
key = key.Substring("APPSETTING_".Length);
|
||||
values.Add("-" + key);
|
||||
values.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
TextFileConfiguration envConfig = new TextFileConfiguration(values.ToArray());
|
||||
args.MergeInto(envConfig, true);
|
||||
return envConfig;
|
||||
}
|
||||
|
||||
public static void OpenBrowser(string url)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user