mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace TestSuite.Utils
|
|
{
|
|
public static class TestHelpers
|
|
{
|
|
public static IConfiguration Configuration { get; }
|
|
|
|
static TestHelpers()
|
|
{
|
|
var basePath = Path.GetFullPath("../../../");
|
|
|
|
Configuration = new ConfigurationBuilder()
|
|
.SetBasePath(basePath)
|
|
.AddJsonFile("appsettings.json", true)
|
|
.AddJsonFile("appsettings.Development.json", true)
|
|
.AddEnvironmentVariables()
|
|
.Build();
|
|
}
|
|
|
|
public static string GetValue(string name, string fallback)
|
|
{
|
|
var value = Configuration[name];
|
|
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
value = fallback;
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Using: {0}={1}", name, value);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
}
|
|
}
|
|
|