Skip to content

Commit

Permalink
Fix order of ops
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Dec 20, 2023
1 parent c9e2d62 commit 731b7d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ public static partial class ConfigurationBuilderExtensions
/// <returns></returns>
public static IConfigurationBuilder AddJsonAndroidAsset(this IConfigurationBuilder builder, string? environment = null, bool optional = true, bool includePlatformSpecific = true)
{
builder.AddJsonAssetInternal("appsettings.json", environment, optional);
if (includePlatformSpecific)
builder.AddJsonAssetInternal("appsettings.android.json", environment, true);

return builder.AddJsonAssetInternal("appsettings.json", environment, optional);
return builder;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static partial class ConfigurationBuilderExtensions
/// <returns></returns>
public static IConfigurationBuilder AddJsonIosBundle(this IConfigurationBuilder builder, string? environment = null, bool optional = true, bool reloadOnChange = true, bool includePlatformSpecific = true)
{
builder.AddJsonFileInternal("appsettings.json", environment, optional, reloadOnChange);
if (includePlatformSpecific)
{
builder.AddJsonFileInternal("appsettings.apple.json", environment, true, reloadOnChange);
Expand All @@ -26,7 +27,7 @@ public static IConfigurationBuilder AddJsonIosBundle(this IConfigurationBuilder
builder.AddJsonFileInternal("appsettings.maccatalyst.json", environment, true, reloadOnChange);
#endif
}
return builder.AddJsonFileInternal("appsettings.json", environment, optional, reloadOnChange);
return builder;
}


Expand All @@ -41,12 +42,13 @@ public static IConfigurationBuilder AddIosUserDefaults(this IConfigurationBuilde

static IConfigurationBuilder AddJsonFileInternal(this IConfigurationBuilder builder, string fileName, string? environment, bool optional, bool reloadOnChange)
{
builder.AddJsonFileInternal(fileName, true, reloadOnChange);
if (!String.IsNullOrWhiteSpace(environment))
{
var newFileName = GetEnvFileName(fileName, environment);
builder.AddJsonFileInternal(newFileName, true, reloadOnChange);
}
return builder.AddJsonFileInternal(fileName, true, reloadOnChange);
return builder;
}


Expand Down

0 comments on commit 731b7d4

Please sign in to comment.