mirror of
https://github.com/azaion/missions.git
synced 2026-06-21 11:31:08 +00:00
chore: update configuration and Docker setup for JWT and test results
ci/woodpecker/push/build-arm Pipeline was successful
ci/woodpecker/push/build-arm Pipeline was successful
Enhanced the .gitignore to exclude test results and updated the Dockerfile to include a new entrypoint script for improved container initialization. Refactored JWT configuration to support additional parameters for automatic refresh intervals, ensuring better control over token management. Updated the ConfigurationResolver to enforce required environment variables without hardcoded fallbacks, enhancing security and flexibility.
This commit is contained in:
@@ -24,4 +24,33 @@ public static class ConfigurationResolver
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Optional positive-integer override (e.g. JWKS refresh interval tuning for tests).
|
||||
// Returns null when unset/whitespace so callers keep library defaults.
|
||||
// Throws when set-but-unparseable or non-positive, so a typo can never silently
|
||||
// weaken behavior.
|
||||
public static int? ResolveOptionalPositiveIntOrThrow(
|
||||
IConfiguration configuration,
|
||||
string envVar,
|
||||
string configKey,
|
||||
string humanLabel)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(configuration);
|
||||
|
||||
var raw = Environment.GetEnvironmentVariable(envVar);
|
||||
if (string.IsNullOrWhiteSpace(raw))
|
||||
raw = configuration[configKey];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(raw))
|
||||
return null;
|
||||
|
||||
if (!int.TryParse(raw, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out var parsed) || parsed <= 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"{humanLabel} is set to '{raw}' which is not a positive integer. " +
|
||||
$"Set {envVar} (or {configKey}) to a positive integer count of seconds, or unset it to use the library default.");
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user