Modify test env var handling
Some checks failed
CI / build-and-test (12) (push) Failing after 33s
CI / build-and-test (13) (push) Failing after 42s
CI / build-and-test (14) (push) Failing after 37s
CI / build-and-test (15) (push) Failing after 31s
CI / build-and-test (latest) (push) Failing after 3m8s
CI / publish (push) Has been skipped
Some checks failed
CI / build-and-test (12) (push) Failing after 33s
CI / build-and-test (13) (push) Failing after 42s
CI / build-and-test (14) (push) Failing after 37s
CI / build-and-test (15) (push) Failing after 31s
CI / build-and-test (latest) (push) Failing after 3m8s
CI / publish (push) Has been skipped
This commit is contained in:
parent
72c11f77e5
commit
aa14333604
@ -6,6 +6,9 @@ on:
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
BBDOX__PG__PORT: 8301
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@ -30,9 +33,6 @@ jobs:
|
||||
ports:
|
||||
- "8301:5432"
|
||||
|
||||
env:
|
||||
BITBADGER__DOCUMENTS__POSTGRES__DBPORT: 8301
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup .NET 6
|
||||
|
@ -53,66 +53,56 @@ public static class PostgresDb
|
||||
/// The host for the database
|
||||
/// </summary>
|
||||
private static readonly Lazy<string> DbHost = new(() =>
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postgres.DbHost") switch
|
||||
Environment.GetEnvironmentVariable("BBDOX_PG_HOST") switch
|
||||
{
|
||||
null => "localhost",
|
||||
var host when host.Trim() == "" => "localhost",
|
||||
var host => host
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The port for the database
|
||||
/// </summary>
|
||||
private static readonly Lazy<int> DbPort = new(() =>
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postgres.DbPort") switch
|
||||
Environment.GetEnvironmentVariable("BBDOX_PG_PORT") switch
|
||||
{
|
||||
null => 5432,
|
||||
var port when port.Trim() == "" => 5432,
|
||||
var port => int.Parse(port)
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The database itself
|
||||
/// </summary>
|
||||
private static readonly Lazy<string> DbDatabase = new(() =>
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postres.DbDatabase") switch
|
||||
Environment.GetEnvironmentVariable("BBDOX_PG_DATABASE") switch
|
||||
{
|
||||
null => "postgres",
|
||||
var db when db.Trim() == "" => "postgres",
|
||||
var db => db
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The user to use in connecting to the database
|
||||
/// </summary>
|
||||
private static readonly Lazy<string> DbUser = new(() =>
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postgres.DbUser") switch
|
||||
Environment.GetEnvironmentVariable("BBDOX_PG_USER") switch
|
||||
{
|
||||
null => "postgres",
|
||||
var user when user.Trim() == "" => "postgres",
|
||||
var user => user
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The password to use for the database
|
||||
/// </summary>
|
||||
private static readonly Lazy<string> DbPassword = new(() =>
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postrgres.DbPwd") switch
|
||||
Environment.GetEnvironmentVariable("BBDOX_PG_PWD") switch
|
||||
{
|
||||
null => "postgres",
|
||||
var pwd when pwd.Trim() == "" => "postgres",
|
||||
var pwd => pwd
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The overall connection string
|
||||
|
Loading…
Reference in New Issue
Block a user