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

quiet output for setup scripts

This commit is contained in:
Kyle Spearrin
2019-03-12 10:26:14 -04:00
parent 14fd7e2801
commit b6f54324a5
8 changed files with 70 additions and 22 deletions

View File

@ -11,6 +11,7 @@ namespace Bit.Setup
private const string ConfigPath = "/bitwarden/config.yml";
public string[] Args { get; set; }
public bool Quiet { get; set; }
public IDictionary<string, string> Parameters { get; set; }
public string OutputDir { get; set; } = "/etc/bitwarden";
public string HostOS { get; set; } = "win";
@ -19,17 +20,22 @@ namespace Bit.Setup
public Installation Install { get; set; } = new Installation();
public Configuration Config { get; set; } = new Configuration();
public bool PrintToScreen()
{
return !Quiet || Parameters.ContainsKey("install");
}
public void LoadConfiguration()
{
if(!File.Exists(ConfigPath))
{
Console.WriteLine("No existing `config.yml` detected. Let's generate one.");
Helpers.WriteLine(this, "No existing `config.yml` detected. Let's generate one.");
// Looks like updating from older version. Try to create config file.
var url = Helpers.GetValueFromEnvFile("global", "globalSettings__baseServiceUri__vault");
if(!Uri.TryCreate(url, UriKind.Absolute, out var uri))
{
Console.WriteLine("Unable to determine existing installation url.");
Helpers.WriteLine(this, "Unable to determine existing installation url.");
return;
}
Config.Url = url;