Skip to content

Commit 47ef775

Browse files
committed
Configure the settings file path to be relative to the current working directory
1 parent d06a89d commit 47ef775

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
using System.IO;
45
using Microsoft.Extensions.Configuration;
56
using Microsoft.OpenApi.OData;
67

@@ -11,15 +12,19 @@ internal static class SettingsUtilities
1112
internal static IConfiguration GetConfiguration(string? settingsFile = null)
1213
{
1314
if (string.IsNullOrEmpty(settingsFile))
15+
{
1416
settingsFile = "appsettings.json";
17+
}
18+
19+
var settingsFilePath = Path.Combine(Directory.GetCurrentDirectory(), settingsFile);
1520

1621
IConfiguration config = new ConfigurationBuilder()
17-
.AddJsonFile(settingsFile, true)
18-
.Build();
22+
.AddJsonFile(settingsFilePath, true)
23+
.Build();
1924

2025
return config;
2126
}
22-
27+
2328
internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion)
2429
{
2530
if (config == null) { throw new System.ArgumentNullException(nameof(config)); }

0 commit comments

Comments
 (0)