Skip to content

Commit

Permalink
Fix issue with long name issue for publisher (#1385) (#1430)
Browse files Browse the repository at this point in the history
* When publisher CLI arguments are provided as long names, they with config settings ending up being ignored. The issue is fixed now by changing the order of processing the arguments.
* Correction of the default value of `fullfeaturedmessage` argument
  • Loading branch information
cristipogacean authored and karok2m committed Oct 18, 2021
1 parent 3f70545 commit 2479d6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public static void Main(string[] args) {
.AddJsonFile("appsettings.json", true)
.AddEnvironmentVariables()
.AddEnvironmentVariables(EnvironmentVariableTarget.User)
.AddLegacyPublisherCommandLine(args)
.AddCommandLine(args)
.AddLegacyPublisherCommandLine(args) // making sure the Legacy arguments are processed at last so they are not overriden
.Build();

#if DEBUG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public LegacyCliOptions(string[] args) {
(bool b) => this[LegacyCliConfigKeys.SkipFirstDefault] = b.ToString() },

{ "fm|fullfeaturedmessage=", "The full featured mode for messages (all fields filled in)." +
"Default is 'true', for legacy compatibility use 'false'",
"Default is 'false' for legacy compatibility.",
(bool b) => this[LegacyCliConfigKeys.FullFeaturedMessage] = b.ToString() },

// Client settings
Expand Down Expand Up @@ -190,6 +190,7 @@ public LegacyCliOptions(string[] args) {
{ "vc|verboseconsole=", "Legacy - do not use.", _ => {} },
{ "as|autotrustservercerts=", "Legacy - do not use.", _ => {} }
};

options.Parse(args);

Config = ToAgentConfigModel();
Expand Down Expand Up @@ -309,7 +310,7 @@ private LegacyCliModel ToLegacyCliModel() {
};
}

private AgentConfigModel ToAgentConfigModel() {
private static AgentConfigModel ToAgentConfigModel() {
return new AgentConfigModel {
AgentId = "StandalonePublisher",
Capabilities = new Dictionary<string, string>(),
Expand All @@ -328,6 +329,6 @@ private T GetValueOrDefault<T>(string key, T defaultValue) {
return (T)converter.ConvertFrom(this[key]);
}

private LegacyCliModel _legacyCliModel = null;
private LegacyCliModel _legacyCliModel;
}
}

0 comments on commit 2479d6b

Please sign in to comment.