Skip to content

Commit

Permalink
Support for .netstandard2.0 (#39)
Browse files Browse the repository at this point in the history
* .net standard 2.0 support

* .net standard 2.0 support

* Fix for vault docker

* Bumped Microsoft.CodeAnalysis.NetAnalyzers to newest version
  • Loading branch information
MrZoidberg authored Aug 31, 2023
1 parent c28ac9b commit aef2c8a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

VaultSharp.Extensions.Configuration is an extension to [VaultSharp](https://github.com/rajanadar/VaultSharp) that allows reading configuration options from Vault.

VaultSharp.Extensions.Configuration is a .NET Standard 2.1 and .NET 6.0 based cross-platform C# Library.
VaultSharp.Extensions.Configuration is a .NET Standard 2.0, 2.1 and .NET 6.0 based cross-platform C# Library.

## Get Started

Expand Down
31 changes: 0 additions & 31 deletions Source/VaultSharp.Extensions.Configuration/VaultChangeToken.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ namespace VaultSharp.Extensions.Configuration
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;

/// <summary>
/// Background service to notify about Vault data changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ private async Task<bool> LoadVaultDataAsync(IVaultClient vaultClient)
this.logger?.LogDebug($"VaultConfigurationProvider: got Vault data with key `{secretData.Key}`");

var key = secretData.Key;
key = key.TrimStart('/')[this.ConfigurationSource.BasePath.TrimStart('/').Length..].TrimStart('/').Replace('/', ':');
var len = this.ConfigurationSource.BasePath.TrimStart('/').Length;
key = key.TrimStart('/').Substring(len).TrimStart('/').Replace('/', ':');
key = this.ReplaceTheAdditionalCharactersForConfigurationPath(key);
var data = secretData.SecretData.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageId>VaultSharp.Extensions.Configuration</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Nullable>enable</Nullable>
<TargetFrameworks>net6.0;net7.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Copyright>Copyright 2023 © Mikhail Merkulov. All rights Reserved</Copyright>
Expand All @@ -17,7 +17,7 @@
<Product>VaultSharp.Extensions.Configuration</Product>
<Description>
Configuration extension that allows you to use Hashicorp Vault as a configuration backend.
This library is built with .NET Standard 2.1, .NET 6 &amp; .NET 7
This library is built with .NET Standard 2.0, 2.1, .NET 6 &amp; .NET 7
</Description>
<PackageTags>Vault;Configuration;Data protection;Hashicorp</PackageTags>
</PropertyGroup>
Expand Down Expand Up @@ -46,12 +46,23 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand All @@ -73,12 +84,16 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<AssemblyTitle>VaultSharp configuration extensions .NET Standard 2.0</AssemblyTitle>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<AssemblyTitle>VaultSharp configuration extensions .NET Standard 2.1</AssemblyTitle>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public IntegrationTests()
private IContainer PrepareVaultContainer(string? script = null)
{
var builder = new ContainerBuilder()
.WithImage("vault")
.WithImage("vault:1.13.3")
.WithName("vaultsharp_test")
.WithPortBinding(8200, 8200)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(8200))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<NoWarn>VSTHRD200;CS1591;CS8618</NoWarn>
</PropertyGroup>

Expand Down Expand Up @@ -53,7 +53,19 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand All @@ -77,7 +89,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit aef2c8a

Please sign in to comment.