Skip to content

Commit

Permalink
Allow overload of the port from config file
Browse files Browse the repository at this point in the history
  • Loading branch information
artemlos committed Mar 9, 2023
1 parent 5f88bd6 commit 817b652
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions LicenseServer/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class LicenseServerConfiguration
public string PathToCacheFolder { get; set; }
[Key(9)]
public string WebAPILogAccessToken { get; set; }
[Key(10)]
public string PathToConfigFile { get; set; }

}

Expand Down
18 changes: 17 additions & 1 deletion LicenseServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace LicenseServer
{
class Program
{
public const string versionInfo = "v2.11 (2023-03-02)" ;
public const string versionInfo = "v2.11 (2023-03-09)" ;

public const string ServiceName = "license-server";

Expand Down Expand Up @@ -134,6 +134,22 @@ public static void Initialization(string[] args, bool runAsService = false)
}

ConfigurationExpires = config.ValidUntil;

if (!string.IsNullOrWhiteSpace(config.PathToConfigFile))
{
try
{
var configData = Newtonsoft.Json.JsonConvert.DeserializeObject<Config>(System.IO.File.ReadAllText(config.PathToConfigFile));

port = configData.Port;
WriteMessage($"Port changed to {port}");

}
catch (Exception ex)
{
WriteMessage($"Config file {config.PathToConfigFile} could not be read. Detailed error message {ex.Message}");
}
}
}
else
{
Expand Down

0 comments on commit 817b652

Please sign in to comment.