use environment variable for configuring BTCPayServer

This commit is contained in:
NicolasDorier
2017-09-28 11:02:21 +09:00
parent e47a5b8721
commit 30eb1bd80e
5 changed files with 14 additions and 8 deletions

View File

@@ -26,7 +26,7 @@
<PackageReference Include="NBXplorer.Client" Version="1.0.0.12" /> <PackageReference Include="NBXplorer.Client" Version="1.0.0.12" />
<PackageReference Include="NicolasDorier.CommandLine" Version="1.0.0.1" /> <PackageReference Include="NicolasDorier.CommandLine" Version="1.0.0.1" />
<PackageReference Include="NicolasDorier.CommandLine.Configuration" Version="1.0.0.2" /> <PackageReference Include="NicolasDorier.CommandLine.Configuration" Version="1.0.0.2" />
<PackageReference Include="NicolasDorier.StandardConfiguration" Version="1.0.0.11" /> <PackageReference Include="NicolasDorier.StandardConfiguration" Version="1.0.0.12" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" /> <PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.0.11" /> <PackageReference Include="System.Xml.XmlSerializer" Version="4.0.11" />

View File

@@ -1,8 +1,11 @@
FROM microsoft/dotnet:2.0.0-sdk FROM microsoft/aspnetcore:2.0.0
RUN mkdir /btcpayserver WORKDIR /app
COPY "dockerfiles/" "/btcpayserver/" COPY "dockerfiles/" .
ENTRYPOINT ["dotnet", "/btcpayserver/BTCPayServer.dll"] ENV BTCPAY_POSTGRES="User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver"
ENV POSTGRES="User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver" ENV BTCPAY_NETWORK="testnet"
CMD ["--testnet", "--explorercookiefile=/.cookie", "--explorerurl=https://nbxplorer-testnet-public.azurewebsites.net/", "--bind=0.0.0.0"] ENV BTCPAY_EXPLORERURL="https://nbxplorer-testnet-public.azurewebsites.net/"
ENV BTCPAY_BIND="0.0.0.0:80"
ENTRYPOINT ["dotnet", "BTCPayServer.dll"]

View File

@@ -1,5 +1,6 @@
pushd . pushd .
cd .. cd ..
dotnet restore
dotnet publish -c Release dotnet publish -c Release
popd popd
robocopy ..\bin\Release\netcoreapp2.0\publish\ dockerfiles /e robocopy ..\bin\Release\netcoreapp2.0\publish\ dockerfiles /e

View File

@@ -34,6 +34,8 @@ namespace BTCPayServer.Configuration
return app; return app;
} }
public override string EnvironmentVariablePrefix => "BTCPAY_";
protected override string GetDefaultDataDir(IConfiguration conf) protected override string GetDefaultDataDir(IConfiguration conf)
{ {
return GetNetwork(conf).DefaultDataDirectory; return GetNetwork(conf).DefaultDataDirectory;

View File

@@ -268,6 +268,7 @@ namespace BTCPayServer.Controllers
var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
RegisteredUserId = user.Id; RegisteredUserId = user.Id;
await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl); await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);
_logger.LogInformation("User created a new account with password.");
if(!policies.RequiresConfirmedEmail) if(!policies.RequiresConfirmedEmail)
{ {
await _signInManager.SignInAsync(user, isPersistent: false); await _signInManager.SignInAsync(user, isPersistent: false);
@@ -278,7 +279,6 @@ namespace BTCPayServer.Controllers
TempData["StatusMessage"] = "Account created, please confirm your email"; TempData["StatusMessage"] = "Account created, please confirm your email";
return View(); return View();
} }
_logger.LogInformation("User created a new account with password.");
} }
AddErrors(result); AddErrors(result);
} }