Application User setup WIP
This commit is contained in:
parent
c83442b4af
commit
cb6dd39596
16 changed files with 362 additions and 314 deletions
|
|
@ -29,7 +29,7 @@ namespace SetupInfrastructure
|
|||
{
|
||||
do
|
||||
{
|
||||
Console.WriteLine("Input <username>:<password>");
|
||||
Console.WriteLine("Input username:password for a superadmin role");
|
||||
userPass = Console.ReadLine() ?? string.Empty;
|
||||
} while (!userPass.Contains(":") || userPass.Split(":").Length != 2 ||
|
||||
string.IsNullOrEmpty(userPass.Split(":")[0]) ||
|
||||
|
|
@ -41,8 +41,10 @@ namespace SetupInfrastructure
|
|||
);
|
||||
_container = new Startup().ConfigureContainer(ctp);
|
||||
|
||||
if (TestDbRole())
|
||||
if (IsSuperAdmin())
|
||||
{
|
||||
var setup = _container.Resolve<Database.Core.DCL.SetupApplicationUser>();
|
||||
setup.With(new Database.Core.DCL.SetupApplicationUser.Command { Password = "3911", Schema = "system", User = "sathumper" });
|
||||
|
||||
// SetupApplicationUser
|
||||
// SetupIdentitySystem
|
||||
|
|
@ -70,7 +72,7 @@ namespace SetupInfrastructure
|
|||
|
||||
}
|
||||
|
||||
static bool TestDbRole()
|
||||
static bool IsSuperAdmin()
|
||||
{
|
||||
var backgroundColor = Console.BackgroundColor;
|
||||
var foregroundColor = Console.ForegroundColor;
|
||||
|
|
|
|||
|
|
@ -5,37 +5,41 @@ using Core.Configurations.JsonConfigProvider;
|
|||
|
||||
namespace SetupInfrastructure
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public virtual IConfigurationRoot Configuration()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.json")
|
||||
.Build();
|
||||
public class Startup
|
||||
{
|
||||
public virtual IConfigurationRoot Configuration()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.json")
|
||||
.Build();
|
||||
|
||||
return configuration;
|
||||
}
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public IContainer ConfigureContainer(ConnectionStringTemplateParameters ctp)
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
var configuration = Configuration();
|
||||
public IContainer ConfigureContainer(ConnectionStringTemplateParameters ctp)
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
var configuration = Configuration();
|
||||
|
||||
|
||||
builder.RegisterModule(new Core.ModuleRegistry.DbPostgreSqlModule
|
||||
{
|
||||
ConnectionString = configuration.GetConnectionString("DefaultConnection").Replace("{usr}", ctp.user).Replace("{pwd}", ctp.pwd)
|
||||
});
|
||||
builder.RegisterModule(new Database.ModuleRegistry.DbPostgreSqlModule
|
||||
{
|
||||
ConnectionString = configuration.GetConnectionString("DefaultConnection").Replace("{usr}", ctp.user).Replace("{pwd}", ctp.pwd)
|
||||
});
|
||||
|
||||
builder.RegisterModule(new Core.ModuleRegistry.TelemetryModule
|
||||
{
|
||||
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<Core.ModuleRegistry.TelemetryConfig>()
|
||||
});
|
||||
builder.RegisterModule(new Core.ModuleRegistry.TelemetryModule
|
||||
{
|
||||
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<Core.ModuleRegistry.TelemetryConfig>()
|
||||
});
|
||||
|
||||
builder.RegisterAssemblyTypes(typeof(Database.Core.IDbConfigure<>).Assembly)
|
||||
.AsClosedTypesOf(typeof(Database.Core.IDbConfigure<>))
|
||||
.AsSelf();
|
||||
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
public record ConnectionStringTemplateParameters(string user, string pwd);
|
||||
}
|
||||
public record ConnectionStringTemplateParameters(string user, string pwd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue