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

Add install-id, install-key, and skip-ssl flags to Setup Project (#1260)

* Add install-id, install-key, and skip-ssl flags

* Update util/Setup/CertBuilder.cs

Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>

* Update util/Setup/Program.cs

Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>

* Remove redundant variable assignment

Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
This commit is contained in:
Vince Grassia 2021-04-06 14:39:27 -04:00 committed by GitHub
parent 79f3dabaac
commit 0366c0efef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 22 deletions

View File

@ -27,6 +27,10 @@ namespace Bit.Setup
_context.Config.Ssl = _context.Config.SslManagedLetsEncrypt;
if (!_context.Config.Ssl)
{
var skipSSL = _context.Parameters.ContainsKey("skip-ssl") && (_context.Parameters["skip-ssl"] == "true" || _context.Parameters["skip-ssl"] == "1");
if (!skipSSL)
{
_context.Config.Ssl = Helpers.ReadQuestion("Do you have a SSL certificate to use?");
if (_context.Config.Ssl)
@ -51,6 +55,7 @@ namespace Bit.Setup
$"-subj \"/C=US/ST=California/L=Santa Barbara/O=Bitwarden Inc./OU=Bitwarden/CN={_context.Install.Domain}\"");
}
}
}
if (_context.Config.SslManagedLetsEncrypt)
{

View File

@ -196,15 +196,35 @@ namespace Bit.Setup
private static bool ValidateInstallation()
{
var installationId = Helpers.ReadInput("Enter your installation id (get at https://bitwarden.com/host)");
var installationId = string.Empty;
var installationKey = string.Empty;
if (_context.Parameters.ContainsKey("install-id"))
{
installationId = _context.Parameters["install-id"].ToLowerInvariant();
}
else
{
installationId = Helpers.ReadInput("Enter your installation id (get at https://bitwarden.com/host)");
}
if (!Guid.TryParse(installationId.Trim(), out var installationidGuid))
{
Console.WriteLine("Invalid installation id.");
return false;
}
if (_context.Parameters.ContainsKey("install-key"))
{
installationKey = _context.Parameters["install-key"];
}
else
{
installationKey = Helpers.ReadInput("Enter your installation key");
}
_context.Install.InstallationId = installationidGuid;
_context.Install.InstallationKey = Helpers.ReadInput("Enter your installation key");
_context.Install.InstallationKey = installationKey;
try
{