1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 05:28:15 -05:00

adjust web appsettings overrides

This commit is contained in:
Kyle Spearrin 2017-12-20 22:48:51 -05:00
parent e7b9ed72c4
commit cf7274aa46
2 changed files with 4 additions and 20 deletions

View File

@ -5,32 +5,16 @@ namespace Bit.Setup
{ {
public class AppSettingsBuilder public class AppSettingsBuilder
{ {
public AppSettingsBuilder(string url, string domain)
{
Url = url;
Domain = domain;
}
public string Url { get; private set; }
public string Domain { get; private set; }
public void Build() public void Build()
{ {
Console.WriteLine("Building app settings."); Console.WriteLine("Building app settings.");
Directory.CreateDirectory("/bitwarden/web/"); Directory.CreateDirectory("/bitwarden/web/");
using(var sw = File.CreateText("/bitwarden/web/settings.js")) using(var sw = File.CreateText("/bitwarden/web/settings.js"))
{ {
sw.Write($@"// Config Parameters sw.Write($@"var bitwardenAppSettings = {{
// Parameter:Url={Url} iconsUri: ""/icons"",
// Parameter:Domain={Domain}
var bitwardenAppSettings = {{
apiUri: ""{Url}/api"",
identityUri: ""{Url}/identity"",
iconsUri: ""{Url}/icons"",
stripeKey: null, stripeKey: null,
braintreeKey: null, braintreeKey: null,
whitelistDomains: [""{Domain}""],
selfHosted: true selfHosted: true
}};"); }};");
} }

View File

@ -187,7 +187,7 @@ namespace Bit.Setup
}; };
environmentFileBuilder.BuildForInstaller(); environmentFileBuilder.BuildForInstaller();
var appSettingsBuilder = new AppSettingsBuilder(url, domain); var appSettingsBuilder = new AppSettingsBuilder();
appSettingsBuilder.Build(); appSettingsBuilder.Build();
var appIdBuilder = new AppIdBuilder(url); var appIdBuilder = new AppIdBuilder(url);
@ -333,7 +333,7 @@ namespace Bit.Setup
var nginxBuilder = new NginxConfigBuilder(domain, url); var nginxBuilder = new NginxConfigBuilder(domain, url);
nginxBuilder.BuildForUpdater(); nginxBuilder.BuildForUpdater();
var appSettingsBuilder = new AppSettingsBuilder(url, domain); var appSettingsBuilder = new AppSettingsBuilder();
appSettingsBuilder.Build(); appSettingsBuilder.Build();
var appIdBuilder = new AppIdBuilder(url); var appIdBuilder = new AppIdBuilder(url);