Adding db infrastructure setup
This commit is contained in:
parent
7dae58ec1e
commit
58bf4bea00
11 changed files with 125 additions and 6 deletions
13
SetupInfrastructure/CreateRole.txt
Normal file
13
SetupInfrastructure/CreateRole.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
CREATE ROLE sathumper WITH
|
||||
CREATEROLE
|
||||
CREATEDB
|
||||
LOGIN
|
||||
PASSWORD '<yoursecretpassword>';
|
||||
|
||||
CREATE SCHEMA ptmain;
|
||||
GRANT USAGE, CREATE ON SCHEMA ptmain TO sathumper;
|
||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA ptmain TO sathumper;
|
||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA ptmain TO sathumper;
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA ptmain
|
||||
GRANT ALL PRIVILEGES ON TABLES TO sathumper;
|
||||
|
||||
22
SetupInfrastructure/Program.cs
Normal file
22
SetupInfrastructure/Program.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
namespace SetupInfrastructure
|
||||
{
|
||||
/// <summary>
|
||||
/// SETUP APPLICATION USER NAMED sathumper
|
||||
///
|
||||
/// This should be handled on the Postgresql db server with a superadmin or similar.
|
||||
///
|
||||
/// Execute SQL CreateRole.txt
|
||||
///
|
||||
/// After that is executed it is time for running this main program
|
||||
/// Remember to use the newly created sathumper
|
||||
/// "ConnectionStrings": {
|
||||
/// "ptdb": "Host=192.168.1.57;Port=5432;Database=ptdb01;User Id=sathumper;Password=<secret>;"
|
||||
/// </summary>
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
20
SetupInfrastructure/SetupInfrastructure.csproj
Normal file
20
SetupInfrastructure/SetupInfrastructure.csproj
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Database\Database.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
9
SetupInfrastructure/appsettings.json
Normal file
9
SetupInfrastructure/appsettings.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"ptdb": "Host=192.168.1.57;Port=5432;Database=ptdb01;User Id=postgres;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