Skip to content

Commit 9888d29

Browse files
authored
Update to Microsoft.Extensions.Configuration version 3. (#81)
1 parent bd935af commit 9888d29

19 files changed

Lines changed: 89 additions & 76 deletions

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ matrix:
1313
- os: linux
1414
dist: xenial
1515
sudo: required
16-
dotnet: 2.2
16+
dotnet: 3.0
1717
- os: osx
18-
osx_image: xcode9 # OSX 10.12
19-
dotnet: 2.2.104
18+
osx_image: xcode11.2
19+
dotnet: 3.0.100
2020
before_install:
2121
- ulimit -n 4096
2222
script:

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ environment:
33
CLI_VERSION: latest
44
DOTNET_CLI_TELEMETRY_OPTOUT: 1
55
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
6-
image: Visual Studio 2017
6+
image: Visual Studio 2019
77
configuration:
88
- Release
99
skip_tags: true
1010
before_build:
11-
- dotnet tool install -g GitVersion.Tool --version 4.0.1-beta1-58
11+
- dotnet tool install -g GitVersion.Tool
1212
- dotnet gitversion /l console /output buildserver
1313
build_script:
1414
- dotnet build -c Release -p:Version=%GitVersion_NuGetVersion%

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set -e
55
# Build
66
dotnet restore
77
dotnet build src/Winton.Extensions.Configuration.Consul -c Release -f netstandard2.0 --no-restore
8-
dotnet build test/Winton.Extensions.Configuration.Consul.Test -c Release -f netcoreapp2.2 --no-restore
9-
dotnet build test/Website -c Release -f netcoreapp2.2 --no-restore
8+
dotnet build test/Winton.Extensions.Configuration.Consul.Test -c Release -f netcoreapp3.0 --no-restore
9+
dotnet build test/Website -c Release -f netcoreapp3.0 --no-restore
1010

1111
# Unit Test
1212
dotnet test -c Release --no-build

src/Winton.Extensions.Configuration.Consul/ConfigurationBuilderExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static class ConfigurationBuilderExtensions
2323
/// The <see cref="CancellationToken" /> used to cancel any open Consul connections or
2424
/// watchers.
2525
/// </param>
26-
/// <returns>The builder</returns>
26+
/// <returns>The builder.</returns>
2727
public static IConfigurationBuilder AddConsul(
2828
this IConfigurationBuilder builder,
2929
string key,
@@ -36,14 +36,14 @@ public static IConfigurationBuilder AddConsul(
3636
/// Adds Consul as a configuration source to the <see cref="IConfigurationBuilder" />
3737
/// and applies the given overrides to the <see cref="IConsulConfigurationSource" />.
3838
/// </summary>
39-
/// <param name="builder">The builder to add consul to</param>
40-
/// <param name="key">The key in consul where the configuration is located</param>
39+
/// <param name="builder">The builder to add consul to.</param>
40+
/// <param name="key">The key in consul where the configuration is located.</param>
4141
/// <param name="cancellationToken">
4242
/// The <see cref="CancellationToken" /> used to cancel any open Consul connections or
4343
/// watchers.
4444
/// </param>
45-
/// <param name="options">An action used to configure the options of the <see cref="IConsulConfigurationSource" /></param>
46-
/// <returns>The builder</returns>
45+
/// <param name="options">An action used to configure the options of the <see cref="IConsulConfigurationSource" />.</param>
46+
/// <returns>The builder.</returns>
4747
public static IConfigurationBuilder AddConsul(
4848
this IConfigurationBuilder builder,
4949
string key,

src/Winton.Extensions.Configuration.Consul/IConsulConfigurationSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Winton.Extensions.Configuration.Consul
1313
{
1414
/// <inheritdoc />
1515
/// <summary>
16-
/// An <see cref="IConfigurationSource" /> for the ConsulConfigurationProvider
16+
/// An <see cref="IConfigurationSource" /> for the ConsulConfigurationProvider.
1717
/// </summary>
1818
public interface IConsulConfigurationSource : IConfigurationSource
1919
{

src/Winton.Extensions.Configuration.Consul/Parsers/Json/JsonConfigurationParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Winton.Extensions.Configuration.Consul.Parsers.Json
1010
{
1111
/// <inheritdoc />
1212
/// <summary>
13-
/// Implemenation of <see cref="IConfigurationParser" /> for parsing JSON Configuration
13+
/// Implementation of <see cref="IConfigurationParser" /> for parsing JSON Configuration.
1414
/// </summary>
1515
public sealed class JsonConfigurationParser : IConfigurationParser
1616
{

src/Winton.Extensions.Configuration.Consul/Parsers/Simple/SimpleConfigurationParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Winton.Extensions.Configuration.Consul.Parsers.Simple
88
{
99
/// <inheritdoc />
1010
/// <summary>
11-
/// Implemenation of <see cref="IConfigurationParser" /> for parsing simple values
11+
/// Implementation of <see cref="IConfigurationParser" /> for parsing simple values.
1212
/// </summary>
1313
public sealed class SimpleConfigurationParser : IConfigurationParser
1414
{

src/Winton.Extensions.Configuration.Consul/Winton.Extensions.Configuration.Consul.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
<ItemGroup>
3333
<PackageReference Include="Consul" Version="0.7.2.6" />
34-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.2" />
35-
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="All" />
34+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" />
35+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
3636
</ItemGroup>
3737

3838
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">

stylecop.json

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
{
2-
"$schema":
3-
"https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/1.0.2/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
4-
"settings": {
5-
"documentationRules": {
6-
"companyName": "Winton",
7-
"copyrightText":
8-
"Copyright (c) {companyName}. All rights reserved.\nLicensed under the Apache License, Version 2.0. See LICENCE in the project root for license information.",
9-
"documentInternalElements": false,
10-
"xmlHeader": false
11-
},
12-
"maintainabilityRules": {
13-
"topLevelTypes": [
14-
"class",
15-
"enum",
16-
"interface",
17-
"struct"
18-
]
19-
},
20-
"orderingRules": {
21-
"blankLinesBetweenUsingGroups": "omit",
22-
"usingDirectivesPlacement": "outsideNamespace"
23-
}
2+
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/1.1.118/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
3+
"settings": {
4+
"documentationRules": {
5+
"companyName": "Winton",
6+
"copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the Apache License, Version 2.0. See LICENCE in the project root for license information.",
7+
"documentInternalElements": false,
8+
"xmlHeader": false
9+
},
10+
"maintainabilityRules": {
11+
"topLevelTypes": [
12+
"class",
13+
"enum",
14+
"interface",
15+
"struct"
16+
]
17+
},
18+
"orderingRules": {
19+
"blankLinesBetweenUsingGroups": "omit",
20+
"usingDirectivesPlacement": "outsideNamespace"
2421
}
22+
}
2523
}

test/Website/Controllers/ConfigController.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33

44
namespace Winton.Extensions.Configuration.Consul.Website.Controllers
55
{
6+
[ApiController]
67
[Route("[controller]")]
7-
public sealed class ConfigController : Controller
8+
public sealed class ConfigController : ControllerBase
89
{
9-
private readonly IConfiguration _configurationRoot;
10+
private readonly IConfiguration _configuration;
1011

1112
public ConfigController(IConfiguration configuration)
1213
{
13-
_configurationRoot = configuration;
14+
_configuration = configuration;
1415
}
1516

1617
[HttpGet("{key}")]
1718
public IActionResult GetValueForKey(string key)
1819
{
19-
return Json(_configurationRoot[key]);
20+
return Ok(_configuration[key]);
2021
}
2122
}
2223
}

0 commit comments

Comments
 (0)