mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-17 22:50:05 +02:00
Support setting WireMockServerSettings via Environment (#954)
* Support parsing environment variables (WireMockServerSettings__) * case ignore * fix * SimpleSettingsParserTests * . * int * more test
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -24,7 +25,7 @@ public static class StandAloneApp
|
||||
[PublicAPI]
|
||||
public static WireMockServer Start(WireMockServerSettings settings)
|
||||
{
|
||||
Guard.NotNull(settings, nameof(settings));
|
||||
Guard.NotNull(settings);
|
||||
|
||||
var server = WireMockServer.Start(settings);
|
||||
|
||||
@@ -42,7 +43,7 @@ public static class StandAloneApp
|
||||
[PublicAPI]
|
||||
public static WireMockServer Start(string[] args, IWireMockLogger? logger = null)
|
||||
{
|
||||
Guard.NotNull(args, nameof(args));
|
||||
Guard.NotNull(args);
|
||||
|
||||
if (TryStart(args, out var server, logger))
|
||||
{
|
||||
@@ -61,9 +62,9 @@ public static class StandAloneApp
|
||||
[PublicAPI]
|
||||
public static bool TryStart(string[] args, [NotNullWhen(true)] out WireMockServer? server, IWireMockLogger? logger = null)
|
||||
{
|
||||
Guard.NotNull(args, nameof(args));
|
||||
Guard.NotNull(args);
|
||||
|
||||
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings, logger))
|
||||
if (WireMockServerSettingsParser.TryParseArguments(args, Environment.GetEnvironmentVariables(), out var settings, logger))
|
||||
{
|
||||
settings.Logger?.Info("Version [{0}]", Version);
|
||||
settings.Logger?.Debug("Server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
|
||||
|
||||
Reference in New Issue
Block a user