feat(sdk-dotnet): add static Envilder facade with sync and async API#167
feat(sdk-dotnet): add static Envilder facade with sync and async API#167
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a public .NET facade (Envilder) and fluent builder for synchronous and asynchronous secret resolution/injection; requires sync ISecretProvider.GetSecret and adds sync provider implementations; internalizes SecretProviderFactory with cross-provider validation and AWS credential/region behavior changes; introduces secret validation helpers, tests, docs, and .NET central build/package settings. Changes
Sequence DiagramsequenceDiagram
participant User
participant Envilder as Envilder (Facade)
participant FS as File System
participant Parser as MapFileParser
participant Factory as SecretProviderFactory
participant Client as EnvilderClient
participant Provider as ISecretProvider
User->>Envilder: ResolveFile(filePath)
Envilder->>FS: Read file contents
FS-->>Envilder: File content
Envilder->>Parser: Parse map file
Parser-->>Envilder: ParsedMapFile
Envilder->>Factory: Create provider (config, options)
Factory-->>Envilder: ISecretProvider
Envilder->>Client: new EnvilderClient(provider)
Envilder->>Client: ResolveSecrets(mapFile)
Client->>Provider: GetSecret(name) for each mapping
Provider-->>Client: secret / null
Client-->>Envilder: Dictionary<string,string>
Envilder-->>User: IReadOnlyDictionary<string,string>
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add static Envilder class with one-liner ResolveFile/Load methods and fluent FromFile builder with WithProvider/WithProfile/WithVaultUrl overrides. Add sync GetSecret to ISecretProvider and implementations. Includes unit tests, fluent chaining tests, and LocalStack acceptance tests. Bump version to 0.2.0.
4dff1de to
8b5eedb
Compare
…/macalbert/envilder into macalbert/feat/dotnet-sdk-facade
- Remove redundant _resolve_region_from_env() from Python profile path - Isolate AWS_PROFILE/AWS_REGION in acceptance test fixtures (Python + .NET)
- Change InjectIntoEnvironment to accept IEnumerable<KeyValuePair> eliminating fragile Dictionary casts in Envilder and EnvilderBuilder - Add input validation to sync GetSecret on AWS SSM and Azure providers - Add cancellationToken.ThrowIfCancellationRequested() to ReadFileAsync and ResolveFileAsync (netstandard2.0 has no cancelable ReadToEndAsync) - Add null check for envMapping in ResolveEnvSource - Add XML documentation to ISecretProvider.GetSecret - Document breaking change in changelog (ISecretProvider new method)
- Add .NET SDK examples for resolving and injecting secrets - Add Python SDK examples for loading, resolving, and environment-based routing - Update changelogs to reflect security fixes and dependency updates - Correct paths and naming conventions in documentation
- Move SecretProviderFactory internalization to Breaking changelog section - Use Mapping instead of Dict for validate_secrets mypy strict compat - Add missing AAA markers in Python validation tests - Narrow except clause to ValueError in localstack container - Guard Directory.Delete with Directory.Exists in test teardown
Summary
Adds a static
Envilderfacade to the .NET SDK providing one-liner and fluent APIs for resolving and injecting secrets, along with synchronousGetSecret/ResolveSecretspaths. Also encapsulates internal factory classes across both .NET and Python SDKs, aligns documentation, and improves cross-provider validation.Changes
.NET SDK — Facade & Sync API
Envilderclass withLoad,ResolveFile,LoadAsync,ResolveFileAsyncLoad(env, mapping),ResolveFile(env, mapping))FromMapFile(path)fluent builder →EnvilderBuilderwithWithProvider,WithProfile,WithVaultUrl→Resolve/Inject/ResolveAsync/InjectAsyncISecretProvider.GetSecret(name)— new sync interface methodAwsSsmSecretProvider.GetSecret(sync viaTask.Run) andAzureKeyVaultSecretProvider.GetSecret(native sync)EnvilderClient.ResolveSecrets(mapFile)— sync secret resolutionSecretValidationExtensions.ValidateSecrets()— opt-in validationSecretProviderFactorymadeinternal;AddEnvilderextensions simplified to(path, options?)EnvilderConfigurationProvider.Load()uses syncResolveSecretsinstead of sync-over-asyncPython SDK — Encapsulation
SecretProviderFactoryrenamed to_SecretProviderFactory(private by convention)__all__re-exportsAWS Region Resolution (both SDKs)
us-east-1fallback)AWS_SHARED_CREDENTIALS_FILEenv varDocumentation & Examples
.NETcode snippet fixed with correctusingnamespacesEnvilder@0.2.*package reference_SecretProviderFactoryand facade APIInfrastructure
Directory.Packages.props)AwesomeAssertions.editorconfigwith tabs/LF enforcementnetstandard2.0target frameworkTesting
Checklist
dotnet build— 0 errors, 0 warningsdotnet test(unit) — 46 passeddotnet format --verify-no-changes— passblack --check+isort --check+mypy --strict— passSummary by CodeRabbit
New Features
Envilderfacade to .NET SDK with one-liner methods (Load,ResolveFile) for simplified secret resolution.FromMapFile()with configuration methods) for advanced scenarios.validate_secrets()function andSecretValidationErrorto Python SDK.Improvements
from_file()→from_map_file()for clarity.