mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-13 06:43:16 +00:00
set environment
This commit is contained in:
@@ -61,7 +61,8 @@ namespace Bit.Console
|
|||||||
Con.WriteLine("5. Simulate directory sync");
|
Con.WriteLine("5. Simulate directory sync");
|
||||||
Con.WriteLine("6. Sync directory");
|
Con.WriteLine("6. Sync directory");
|
||||||
Con.WriteLine("7. Control background service");
|
Con.WriteLine("7. Control background service");
|
||||||
Con.WriteLine("8. Exit");
|
Con.WriteLine("8. Set environment");
|
||||||
|
Con.WriteLine("9. Exit");
|
||||||
Con.WriteLine();
|
Con.WriteLine();
|
||||||
Con.Write("What would you like to do? ");
|
Con.Write("What would you like to do? ");
|
||||||
selection = Con.ReadLine();
|
selection = Con.ReadLine();
|
||||||
@@ -105,6 +106,12 @@ namespace Bit.Console
|
|||||||
case "service":
|
case "service":
|
||||||
await ServiceAsync();
|
await ServiceAsync();
|
||||||
break;
|
break;
|
||||||
|
case "8":
|
||||||
|
case "environnment":
|
||||||
|
case "env":
|
||||||
|
await DebugAsync();
|
||||||
|
break;
|
||||||
|
case "9":
|
||||||
case "exit":
|
case "exit":
|
||||||
case "quit":
|
case "quit":
|
||||||
case "q":
|
case "q":
|
||||||
@@ -708,6 +715,7 @@ namespace Bit.Console
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Con.WriteLine("Service current status: {0}", ControllerService.Instance.StatusString);
|
Con.WriteLine("Service current status: {0}", ControllerService.Instance.StatusString);
|
||||||
|
Con.WriteLine();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -759,6 +767,7 @@ namespace Bit.Console
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Con.WriteLine();
|
||||||
if(start)
|
if(start)
|
||||||
{
|
{
|
||||||
Con.WriteLine("Starting service...");
|
Con.WriteLine("Starting service...");
|
||||||
@@ -777,6 +786,57 @@ namespace Bit.Console
|
|||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Task DebugAsync()
|
||||||
|
{
|
||||||
|
if(_usingArgs)
|
||||||
|
{
|
||||||
|
var parameters = ParseParameters();
|
||||||
|
if(parameters.ContainsKey("debug"))
|
||||||
|
{
|
||||||
|
SettingsService.Instance.ApiBaseUrl = "http://localhost:4000";
|
||||||
|
SettingsService.Instance.IdentityBaseUrl = "http://localhost:33656";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(parameters.ContainsKey("api"))
|
||||||
|
{
|
||||||
|
SettingsService.Instance.ApiBaseUrl = parameters["api"];
|
||||||
|
}
|
||||||
|
if(parameters.ContainsKey("id"))
|
||||||
|
{
|
||||||
|
SettingsService.Instance.IdentityBaseUrl = parameters["id"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var input = string.Empty;
|
||||||
|
|
||||||
|
Con.Write("API [{0}]: ", SettingsService.Instance.ApiBaseUrl);
|
||||||
|
input = Con.ReadLine();
|
||||||
|
if(input == "debug")
|
||||||
|
{
|
||||||
|
SettingsService.Instance.ApiBaseUrl = "http://localhost:4000";
|
||||||
|
}
|
||||||
|
else if(!string.IsNullOrEmpty(input))
|
||||||
|
{
|
||||||
|
SettingsService.Instance.ApiBaseUrl = input;
|
||||||
|
}
|
||||||
|
Con.Write("Identity [{0}]: ", SettingsService.Instance.IdentityBaseUrl);
|
||||||
|
input = Con.ReadLine();
|
||||||
|
if(input == "debug")
|
||||||
|
{
|
||||||
|
SettingsService.Instance.IdentityBaseUrl = "http://localhost:33656";
|
||||||
|
}
|
||||||
|
else if(!string.IsNullOrEmpty(input))
|
||||||
|
{
|
||||||
|
SettingsService.Instance.IdentityBaseUrl = input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.FromResult(0);
|
||||||
|
}
|
||||||
|
|
||||||
private static string ReadSecureLine()
|
private static string ReadSecureLine()
|
||||||
{
|
{
|
||||||
var input = string.Empty;
|
var input = string.Empty;
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
public class SettingsModel
|
public class SettingsModel
|
||||||
{
|
{
|
||||||
public string ApiBaseUrl { get; set; }
|
public string ApiBaseUrl { get; set; } = "https://api.bitwarden.com";
|
||||||
public string IdentityBaseUrl { get; set; }
|
public string IdentityBaseUrl { get; set; } = "https://identity.bitwarden.com";
|
||||||
public EncryptedData AccessToken { get; set; }
|
public EncryptedData AccessToken { get; set; }
|
||||||
public EncryptedData RefreshToken { get; set; }
|
public EncryptedData RefreshToken { get; set; }
|
||||||
public ServerConfiguration Server { get; set; }
|
public ServerConfiguration Server { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user