Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.3 Maintenance Release 2 #367

Merged
merged 32 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
47832f6
Update docs for the latest release version
nblumhardt May 8, 2024
8af28fa
Merge pull request #348 from nblumhardt/update-command-help
KodrAus May 8, 2024
0bd42e5
Pascal case permissions
sctmike May 14, 2024
3137325
ignore case when parsing permission string into Seq.Api.Model.Securit…
sctmike May 15, 2024
b62577b
Merge pull request #353 from sctmike/dev
nblumhardt May 15, 2024
6f786ea
Update README.md with `update` example [skip ci]
nblumhardt May 23, 2024
c35500d
Add environment variables doc
liammclennan Jun 11, 2024
1a19799
Merge pull request #356 from liammclennan/add-environmentvariables-doc
KodrAus Jun 11, 2024
e64d4a8
update dotnet toolchain to 8.0.302
KodrAus Jun 30, 2024
c3421e5
Merge pull request #357 from KodrAus/chore/dotnet-version
nblumhardt Jul 1, 2024
1fec903
Only include detailed HTTP diagnostics in `node health` output when `…
nblumhardt Jul 8, 2024
fa7c50b
Allow the -i <FILENAME> argument to be specified multiple times
nblumhardt Jul 9, 2024
cafc038
Merge pull request #359 from nblumhardt/multiple-i-args
KodrAus Jul 9, 2024
dc131b4
Fix test
nblumhardt Jul 9, 2024
13c8ae8
Merge pull request #358 from nblumhardt/tidy-health-output
nblumhardt Jul 9, 2024
3dfdf3a
Add Organization to the list of permissions documented for the `apike…
nblumhardt Jul 10, 2024
31d9a7c
Merge pull request #360 from nblumhardt/list-perms
KodrAus Jul 10, 2024
69c8221
update to .NET 8.0.303
KodrAus Jul 10, 2024
0bc9d1a
Merge pull request #361 from datalust/chore/dotnet-8-0-303
nblumhardt Jul 11, 2024
69d7199
Use restrictive global.json during CI builds only
nblumhardt Aug 1, 2024
6786bd1
Use ci.global.json in CI setup
nblumhardt Sep 13, 2024
34dff11
Same change for Linux
nblumhardt Sep 13, 2024
118d6ec
Merge pull request #363 from nblumhardt/global-json-only-ci
nblumhardt Sep 13, 2024
b313db5
Align seqcli's environment override handling with Seq's
nblumhardt Oct 11, 2024
b4a2b45
Doc improvements
nblumhardt Oct 11, 2024
7896085
Retain the old file read/init behavior for now
nblumhardt Oct 11, 2024
dc29e0c
Merge pull request #366 from nblumhardt/env-var-config
nblumhardt Oct 11, 2024
94230a9
Update all NuGet dependencies
nblumhardt Oct 11, 2024
26ffcad
Merge pull request #368 from nblumhardt/nuget-updates-2024-10
nblumhardt Oct 11, 2024
7f4e543
Fix exception when writing `connection.apiKey` values
nblumhardt Oct 11, 2024
5b5d5c9
One further tweak; since env vars now use the KeyValueSettings.Set() …
nblumhardt Oct 11, 2024
8c0e0e2
Merge pull request #369 from nblumhardt/exception-when-setting-config
nblumhardt Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/SeqCli/Config/EnvironmentOverrides.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
// Copyright © Datalust Pty Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

Expand Down Expand Up @@ -30,7 +43,7 @@ internal static void Apply(string prefix, SeqCliConfig config, Dictionary<string
}
}

internal static string ToEnvironmentVariableName(string prefix, string key)
static string ToEnvironmentVariableName(string prefix, string key)
{
return prefix + key.Replace(".", "_").ToUpperInvariant();
}
Expand Down
29 changes: 23 additions & 6 deletions src/SeqCli/Config/KeyValueSettings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright © Datalust Pty Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -24,7 +38,7 @@ public static void Set(SeqCliConfig config, string key, string? value)
for (var i = 0; i < steps.Length - 1; ++i)
{
var nextStep = receiver.GetType().GetTypeInfo().DeclaredProperties
.Where(p => p.CanRead && p.GetMethod!.IsPublic && !p.GetMethod.IsStatic && p.GetCustomAttribute<ObsoleteAttribute>() == null)
.Where(p => p.CanRead && p.GetMethod!.IsPublic && !p.GetMethod.IsStatic && p.GetCustomAttribute<JsonIgnoreAttribute>() == null)
.SingleOrDefault(p => Camelize(GetUserFacingName(p)) == steps[i]);

if (nextStep == null)
Expand All @@ -38,10 +52,12 @@ public static void Set(SeqCliConfig config, string key, string? value)
throw new InvalidOperationException("Intermediate configuration object is null.");
}

// FUTURE: the use of `p.Name` and lack of `JsonIgnoreAttribute` checks here mean that sensitive values can
// intercept writes through hidden properties, triggering encoding where supported. A type-based solution
// would be more robust.
var targetProperty = receiver.GetType().GetTypeInfo().DeclaredProperties
.Where(p => p is { CanRead: true, CanWrite: true } && p.GetMethod!.IsPublic && p.SetMethod!.IsPublic &&
!p.GetMethod.IsStatic && p.GetCustomAttribute<ObsoleteAttribute>() == null)
.SingleOrDefault(p => Camelize(GetUserFacingName(p)) == steps[^1]);
.Where(p => p is { CanRead: true, CanWrite: true } && p.GetMethod!.IsPublic && p.SetMethod!.IsPublic && !p.GetMethod.IsStatic)
.SingleOrDefault(p => Camelize(p.Name) == steps[^1]);

if (targetProperty == null)
throw new ArgumentException("The key could not be found; run `seqcli config list` to view all keys.");
Expand All @@ -56,7 +72,7 @@ public static void Set(SeqCliConfig config, string key, string? value)
return value?.Split(',').Select(e => e.Trim()).ToArray() ?? [];

if (propertyType == typeof(int[]))
return value?.Split(',').Select(e => int.Parse(e.Trim(), CultureInfo.InvariantCulture)).ToArray() ?? Array.Empty<int>();
return value?.Split(',').Select(e => int.Parse(e.Trim(), CultureInfo.InvariantCulture)).ToArray() ?? [];

if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
Expand Down Expand Up @@ -98,7 +114,7 @@ public static bool TryGetValue(object config, string key, out string? value, [No
{
foreach (var nextStep in receiver.GetType().GetTypeInfo().DeclaredProperties
.Where(p => p.CanRead && p.GetMethod!.IsPublic &&
!p.GetMethod.IsStatic && p.GetCustomAttribute<ObsoleteAttribute>() == null)
!p.GetMethod.IsStatic && p.GetCustomAttribute<ObsoleteAttribute>() == null && p.GetCustomAttribute<JsonIgnoreAttribute>() == null)
.OrderBy(GetUserFacingName))
{
var camel = Camelize(GetUserFacingName(nextStep));
Expand Down Expand Up @@ -131,6 +147,7 @@ public static bool TryGetValue(object config, string key, out string? value, [No
else if (nextStep.CanRead && nextStep.GetMethod!.IsPublic &&
nextStep.CanWrite && nextStep.SetMethod!.IsPublic &&
!nextStep.SetMethod.IsStatic &&
nextStep.GetCustomAttribute<ObsoleteAttribute>() == null &&
nextStep.GetCustomAttribute<JsonIgnoreAttribute>() == null)
{
var value = nextStep.GetValue(receiver);
Expand Down
14 changes: 14 additions & 0 deletions src/SeqCli/Config/RuntimeConfigurationLoader.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright © Datalust Pty Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.IO;

Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Config/SeqCliConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void WriteToFile(SeqCliConfig data, string filename)
{
if (!data._exportable)
throw new InvalidOperationException("The provided configuration is not exportable.");

var content = JsonConvert.SerializeObject(data, Formatting.Indented, SerializerSettings);
File.WriteAllText(filename, content);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SeqCli/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"profiles": {
"SeqCli": {
"commandName": "Project",
"commandLineArgs": "signal update --json-stdin"
"commandLineArgs": "config -k connection.apiKey -v test"
}
}
}