Skip to content

Commit

Permalink
RavenDB-22246 renamed the property
Browse files Browse the repository at this point in the history
  • Loading branch information
ppekrol committed Aug 26, 2024
1 parent 9bdb15a commit bc4eb18
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions src/Raven.Embedded/RavenServerRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ public static async Task<Process> RunAsync(ServerOptions options)
commandLineArgs.Add($"--Embedded.ParentProcessId={currentProcess.Id}");
}

if (options.LicenseConfiguration != null)
if (options.Licensing != null)
{
if (string.IsNullOrWhiteSpace(options.LicenseConfiguration.License) == false &&
string.IsNullOrWhiteSpace(options.LicenseConfiguration.LicensePath) == false)
throw new ArgumentException($"Only one of Licence options '{nameof(options.LicenseConfiguration.License)}' or '{nameof(options.LicenseConfiguration.LicensePath)}' should be specified");

if (string.IsNullOrWhiteSpace(options.LicenseConfiguration.License) == false)
commandLineArgs.Add($"--License={CommandLineArgumentEscaper.EscapeSingleArg(options.LicenseConfiguration.License)}");
else if (string.IsNullOrWhiteSpace(options.LicenseConfiguration.LicensePath) == false)
commandLineArgs.Add($"--License.Path={CommandLineArgumentEscaper.EscapeSingleArg(options.LicenseConfiguration.LicensePath)}");

commandLineArgs.Add($"--License.Eula.Accepted={options.LicenseConfiguration.EulaAccepted}");
commandLineArgs.Add($"--License.DisableAutoUpdate={options.LicenseConfiguration.DisableAutoUpdate}");
commandLineArgs.Add($"--License.DisableAutoUpdateFromApi={options.LicenseConfiguration.DisableAutoUpdateFromApi}");
commandLineArgs.Add($"--License.DisableLicenseSupportCheck={options.LicenseConfiguration.DisableLicenseSupportCheck}");
commandLineArgs.Add($"--License.ThrowOnInvalidOrMissingLicense={options.LicenseConfiguration.ThrowOnInvalidOrMissingLicense}");
if (string.IsNullOrWhiteSpace(options.Licensing.License) == false &&
string.IsNullOrWhiteSpace(options.Licensing.LicensePath) == false)
throw new ArgumentException($"Only one of Licence options '{nameof(options.Licensing.License)}' or '{nameof(options.Licensing.LicensePath)}' should be specified");

if (string.IsNullOrWhiteSpace(options.Licensing.License) == false)
commandLineArgs.Add($"--License={CommandLineArgumentEscaper.EscapeSingleArg(options.Licensing.License)}");
else if (string.IsNullOrWhiteSpace(options.Licensing.LicensePath) == false)
commandLineArgs.Add($"--License.Path={CommandLineArgumentEscaper.EscapeSingleArg(options.Licensing.LicensePath)}");

commandLineArgs.Add($"--License.Eula.Accepted={options.Licensing.EulaAccepted}");
commandLineArgs.Add($"--License.DisableAutoUpdate={options.Licensing.DisableAutoUpdate}");
commandLineArgs.Add($"--License.DisableAutoUpdateFromApi={options.Licensing.DisableAutoUpdateFromApi}");
commandLineArgs.Add($"--License.DisableLicenseSupportCheck={options.Licensing.DisableLicenseSupportCheck}");
commandLineArgs.Add($"--License.ThrowOnInvalidOrMissingLicense={options.Licensing.ThrowOnInvalidOrMissingLicense}");
}

commandLineArgs.Add("--Setup.Mode=None");
Expand Down
12 changes: 6 additions & 6 deletions src/Raven.Embedded/ServerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public class ServerOptions
public string DotNetPath { get; set; } = "dotnet";

[Obsolete(
$"This property is no longer used and will be removed in the next version, please use '{nameof(LicenseConfiguration)}.{nameof(LicenseOptions.EulaAccepted)}' instead.")]
$"This property is no longer used and will be removed in the next version, please use '{nameof(Licensing)}.{nameof(LicensingOptions.EulaAccepted)}' instead.")]
public bool AcceptEula
{
get => LicenseConfiguration.EulaAccepted;
set => LicenseConfiguration.EulaAccepted = value;
get => Licensing.EulaAccepted;
set => Licensing.EulaAccepted = value;
}

public string ServerUrl { get; set; }
Expand All @@ -41,6 +41,8 @@ public bool AcceptEula

public SecurityOptions Security { get; private set; }

public LicensingOptions Licensing { get; set; } = new();

public ServerOptions Secured(string certificate, string certPassword = null)
{
if (certificate == null)
Expand Down Expand Up @@ -95,9 +97,7 @@ internal SecurityOptions() { }
public string ServerCertificateThumbprint { get; internal set; }
}

public LicenseOptions LicenseConfiguration { get; set; } = new();

public class LicenseOptions
public class LicensingOptions
{
public string License { get; set; }
public string LicensePath { get; set; }
Expand Down
18 changes: 9 additions & 9 deletions test/LicenseTests/LicenseOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private void StartEmbeddedServerLicenseOptionTest(bool throwOnInvalidOrMissingLi
var originalLicensePath = Environment.GetEnvironmentVariable("RAVEN_License.Path");

options = CopyServerAndCreateOptions();
options.LicenseConfiguration.ThrowOnInvalidOrMissingLicense = throwOnInvalidOrMissingLicense;
options.Licensing.ThrowOnInvalidOrMissingLicense = throwOnInvalidOrMissingLicense;

try
{
Expand Down Expand Up @@ -282,8 +282,8 @@ private static void HandleLicenseOption(string license, LicenseSource licenseSou
switch (licenseSource)
{
case LicenseSource.EnvironmentVariable:
Assert.Null(options.LicenseConfiguration.License);
Assert.Null(options.LicenseConfiguration.LicensePath);
Assert.Null(options.Licensing.License);
Assert.Null(options.Licensing.LicensePath);

Environment.SetEnvironmentVariable("RAVEN_License", license);
Environment.SetEnvironmentVariable("RAVEN_License.Path", null);
Expand All @@ -293,8 +293,8 @@ private static void HandleLicenseOption(string license, LicenseSource licenseSou
break;

case LicenseSource.ServerOption:
options.LicenseConfiguration.License = license;
Assert.Null(options.LicenseConfiguration.LicensePath);
options.Licensing.License = license;
Assert.Null(options.Licensing.LicensePath);

Environment.SetEnvironmentVariable("RAVEN_License", null);
Environment.SetEnvironmentVariable("RAVEN_License.Path", null);
Expand All @@ -315,8 +315,8 @@ private static void HandleLicensePathOption(string license, LicenseSource licens
switch (licenseSource)
{
case LicenseSource.EnvironmentVariable:
Assert.Null(options.LicenseConfiguration.License);
Assert.Null(options.LicenseConfiguration.LicensePath);
Assert.Null(options.Licensing.License);
Assert.Null(options.Licensing.LicensePath);

Environment.SetEnvironmentVariable("RAVEN_License", null);
Environment.SetEnvironmentVariable("RAVEN_License.Path", licensePath);
Expand All @@ -326,8 +326,8 @@ private static void HandleLicensePathOption(string license, LicenseSource licens
break;

case LicenseSource.ServerOption:
options.LicenseConfiguration.LicensePath = licensePath;
Assert.Null(options.LicenseConfiguration.License);
options.Licensing.LicensePath = licensePath;
Assert.Null(options.Licensing.License);

Environment.SetEnvironmentVariable("RAVEN_License", null);
Environment.SetEnvironmentVariable("RAVEN_License.Path", null);
Expand Down

0 comments on commit bc4eb18

Please sign in to comment.