WIP
This commit is contained in:
parent
6839cd82e2
commit
cf25e6fa0a
5 changed files with 44 additions and 17 deletions
|
|
@ -41,7 +41,7 @@ namespace PlanTempus
|
|||
|
||||
builder.RegisterModule(new Core.ModuleRegistry.TelemetryModule
|
||||
{
|
||||
TelemetryConfig = ConfigurationRoot.GetSection(nameof(Core.ModuleRegistry.TelemetryConfig)).Get<Core.ModuleRegistry.TelemetryConfig>()
|
||||
TelemetryConfig = ConfigurationRoot.GetSection(nameof(Core.ModuleRegistry.TelemetryConfig)).ToObject<Core.ModuleRegistry.TelemetryConfig>()
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Database.Core.DDL
|
|||
/// <param name="schema">The schema name where the tables will be created.</param>
|
||||
public void With(Command emptyByIntention)
|
||||
{
|
||||
using (_transaction = _db.BeginTransaction())
|
||||
using (_transaction = _db.OpenWithTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -56,7 +56,7 @@ namespace Database.Core.DDL
|
|||
/// <summary>
|
||||
/// Creates the users table
|
||||
/// </summary>
|
||||
public void CreateUsersTable()
|
||||
void CreateUsersTable()
|
||||
{
|
||||
var sql = @"
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
|
|
@ -80,7 +80,7 @@ namespace Database.Core.DDL
|
|||
/// <summary>
|
||||
/// Creates the tenants table
|
||||
/// </summary>
|
||||
public void CreateTenantsTable()
|
||||
void CreateTenantsTable()
|
||||
{
|
||||
var sql = @"
|
||||
CREATE TABLE IF NOT EXISTS tenants (
|
||||
|
|
@ -98,7 +98,7 @@ namespace Database.Core.DDL
|
|||
/// <summary>
|
||||
/// Creates the user_tenants table
|
||||
/// </summary>
|
||||
public void CreateUserTenantsTable()
|
||||
void CreateUserTenantsTable()
|
||||
{
|
||||
var sql = @"
|
||||
CREATE TABLE IF NOT EXISTS user_tenants (
|
||||
|
|
@ -116,7 +116,7 @@ namespace Database.Core.DDL
|
|||
/// <summary>
|
||||
/// Sets up Row Level Security (RLS) for the tenants and user_tenants tables.
|
||||
/// </summary>
|
||||
public void SetupRLS()
|
||||
void SetupRLS()
|
||||
{
|
||||
var sql = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@ namespace SetupInfrastructure
|
|||
internal class Program
|
||||
{
|
||||
static IContainer _container;
|
||||
static ConsoleColor _backgroundColor = Console.BackgroundColor;
|
||||
static ConsoleColor _foregroundColor = Console.ForegroundColor;
|
||||
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
|
||||
Welcome();
|
||||
string userPass;
|
||||
|
||||
try
|
||||
|
|
@ -43,10 +45,17 @@ namespace SetupInfrastructure
|
|||
|
||||
if (IsSuperAdmin())
|
||||
{
|
||||
var setup = _container.Resolve<Database.Core.DCL.SetupApplicationUser>();
|
||||
setup.With(new Database.Core.DCL.SetupApplicationUser.Command { Password = "3911", Schema = "system", User = "sathumper" });
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
var setupApplicationUser = _container.Resolve<Database.Core.DCL.SetupApplicationUser>();
|
||||
setupApplicationUser.With(new Database.Core.DCL.SetupApplicationUser.Command { Password = "3911", Schema = "system", User = "sathumper" });
|
||||
Console.WriteLine("Database.Core.DCL.SetupApplicationUser done!");
|
||||
Console.WriteLine();
|
||||
|
||||
// SetupApplicationUser
|
||||
//create new container with application user, we use that role from now.
|
||||
_container = new Startup().ConfigureContainer(new Startup.ConnectionStringTemplateParameters("sathumper", "3911"));
|
||||
|
||||
var setupIdentitySystem = _container.Resolve<Database.Core.DDL.SetupIdentitySystem>();
|
||||
setupIdentitySystem.With(new Database.Core.DDL.SetupIdentitySystem.Command());
|
||||
// SetupIdentitySystem
|
||||
// SetupConfiguration
|
||||
|
||||
|
|
@ -56,7 +65,7 @@ namespace SetupInfrastructure
|
|||
|
||||
// input configurations!!! TODO:Missing
|
||||
|
||||
|
||||
Console.ForegroundColor = _foregroundColor;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -74,8 +83,7 @@ namespace SetupInfrastructure
|
|||
|
||||
static bool IsSuperAdmin()
|
||||
{
|
||||
var backgroundColor = Console.BackgroundColor;
|
||||
var foregroundColor = Console.ForegroundColor;
|
||||
|
||||
|
||||
//test db access
|
||||
Console.WriteLine("Testing db access...");
|
||||
|
|
@ -96,7 +104,7 @@ namespace SetupInfrastructure
|
|||
Console.WriteLine("TEST SUCCESSFULLY");
|
||||
Console.WriteLine();
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.BackgroundColor = backgroundColor;
|
||||
Console.BackgroundColor = _backgroundColor;
|
||||
Console.WriteLine("-------------------------------");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"Username: {username}");
|
||||
|
|
@ -118,7 +126,7 @@ namespace SetupInfrastructure
|
|||
Console.WriteLine("TEST WAS NOT SUCCESSFULLY");
|
||||
Console.WriteLine();
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.BackgroundColor = backgroundColor;
|
||||
Console.BackgroundColor = _backgroundColor;
|
||||
Console.WriteLine("-------------------------------");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"Username: {username}");
|
||||
|
|
@ -133,6 +141,25 @@ namespace SetupInfrastructure
|
|||
return false;
|
||||
|
||||
|
||||
}
|
||||
static void Welcome()
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Blue;
|
||||
Console.WriteLine(@"__________.__ ___________
|
||||
\______ \ | _____ ___\__ ___/___ _____ ______ __ __ ______
|
||||
| ___/ | \__ \ / \| |_/ __ \ / \\____ \| | \/ ___/
|
||||
| | | |__/ __ \| | \ |\ ___/| Y Y \ |_> > | /\___ \
|
||||
|____| |____(____ /___| /____| \___ >__|_| / __/|____//____ >
|
||||
\/ \/ \/ \/|__| \/
|
||||
_________ __
|
||||
/ _____/ _____/ |_ __ ________
|
||||
\_____ \_/ __ \ __\ | \____ \
|
||||
/ \ ___/| | | | / |_> >
|
||||
/_______ /\___ >__| |____/| __/
|
||||
\/ \/ |__|");
|
||||
Console.WriteLine();
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=192.168.1.57;Port=5432;Database=sandbox;User Id=postgres;Password=3911;"
|
||||
"DefaultConnection": "Host=192.168.1.57;Port=5432;Database=ptmain;User Id=sathumper;Password=3911;"
|
||||
},
|
||||
"ApplicationInsights": {
|
||||
"ConnectionString": "InstrumentationKey=6d2e76ee-5343-4691-a5e3-81add43cb584;IngestionEndpoint=https://northeurope-0.in.applicationinsights.azure.com/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue