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:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
BBDOX__PG__PORT: 8301
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
|
|
||||||
|
@ -30,9 +33,6 @@ jobs:
|
||||||
ports:
|
ports:
|
||||||
- "8301:5432"
|
- "8301:5432"
|
||||||
|
|
||||||
env:
|
|
||||||
BITBADGER__DOCUMENTS__POSTGRES__DBPORT: 8301
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup .NET 6
|
- name: Setup .NET 6
|
||||||
|
|
|
@ -53,65 +53,55 @@ public static class PostgresDb
|
||||||
/// The host for the database
|
/// The host for the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Lazy<string> DbHost = new(() =>
|
private static readonly Lazy<string> DbHost = new(() =>
|
||||||
{
|
Environment.GetEnvironmentVariable("BBDOX_PG_HOST") switch
|
||||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postgres.DbHost") switch
|
|
||||||
{
|
{
|
||||||
null => "localhost",
|
null => "localhost",
|
||||||
var host when host.Trim() == "" => "localhost",
|
var host when host.Trim() == "" => "localhost",
|
||||||
var host => host
|
var host => host
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The port for the database
|
/// The port for the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Lazy<int> DbPort = new(() =>
|
private static readonly Lazy<int> DbPort = new(() =>
|
||||||
{
|
Environment.GetEnvironmentVariable("BBDOX_PG_PORT") switch
|
||||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postgres.DbPort") switch
|
|
||||||
{
|
{
|
||||||
null => 5432,
|
null => 5432,
|
||||||
var port when port.Trim() == "" => 5432,
|
var port when port.Trim() == "" => 5432,
|
||||||
var port => int.Parse(port)
|
var port => int.Parse(port)
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The database itself
|
/// The database itself
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Lazy<string> DbDatabase = new(() =>
|
private static readonly Lazy<string> DbDatabase = new(() =>
|
||||||
{
|
Environment.GetEnvironmentVariable("BBDOX_PG_DATABASE") switch
|
||||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postres.DbDatabase") switch
|
|
||||||
{
|
{
|
||||||
null => "postgres",
|
null => "postgres",
|
||||||
var db when db.Trim() == "" => "postgres",
|
var db when db.Trim() == "" => "postgres",
|
||||||
var db => db
|
var db => db
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user to use in connecting to the database
|
/// The user to use in connecting to the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Lazy<string> DbUser = new(() =>
|
private static readonly Lazy<string> DbUser = new(() =>
|
||||||
{
|
Environment.GetEnvironmentVariable("BBDOX_PG_USER") switch
|
||||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postgres.DbUser") switch
|
|
||||||
{
|
{
|
||||||
null => "postgres",
|
null => "postgres",
|
||||||
var user when user.Trim() == "" => "postgres",
|
var user when user.Trim() == "" => "postgres",
|
||||||
var user => user
|
var user => user
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The password to use for the database
|
/// The password to use for the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Lazy<string> DbPassword = new(() =>
|
private static readonly Lazy<string> DbPassword = new(() =>
|
||||||
{
|
Environment.GetEnvironmentVariable("BBDOX_PG_PWD") switch
|
||||||
return Environment.GetEnvironmentVariable("BitBadger.Documents.Postrgres.DbPwd") switch
|
|
||||||
{
|
{
|
||||||
null => "postgres",
|
null => "postgres",
|
||||||
var pwd when pwd.Trim() == "" => "postgres",
|
var pwd when pwd.Trim() == "" => "postgres",
|
||||||
var pwd => pwd
|
var pwd => pwd
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user