Skip to content

Commit 804d688

Browse files
authored
chore: Favor environment configuration over properties file (#899)
1 parent 7343c73 commit 804d688

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/Testcontainers/Builders/DockerRegistryAuthenticationProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public IDockerRegistryAuthenticationConfiguration GetAuthConfig(string hostname)
7070

7171
private static string GetDefaultDockerConfigFilePath()
7272
{
73-
var dockerConfigDirectoryPath = PropertiesFileConfiguration.Instance.GetDockerConfig() ?? EnvironmentConfiguration.Instance.GetDockerConfig() ?? UserProfileDockerConfigDirectoryPath;
73+
var dockerConfigDirectoryPath = EnvironmentConfiguration.Instance.GetDockerConfig() ?? PropertiesFileConfiguration.Instance.GetDockerConfig() ?? UserProfileDockerConfigDirectoryPath;
7474
return Path.Combine(dockerConfigDirectoryPath, "config.json");
7575
}
7676

7777
private static JsonDocument GetDefaultDockerAuthConfig()
7878
{
79-
return PropertiesFileConfiguration.Instance.GetDockerAuthConfig() ?? EnvironmentConfiguration.Instance.GetDockerAuthConfig() ?? JsonDocument.Parse("{}");
79+
return EnvironmentConfiguration.Instance.GetDockerAuthConfig() ?? PropertiesFileConfiguration.Instance.GetDockerAuthConfig() ?? JsonDocument.Parse("{}");
8080
}
8181

8282
private IDockerRegistryAuthenticationConfiguration GetUncachedAuthConfig(string hostname)

src/Testcontainers/Builders/EnvironmentEndpointAuthenticationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal sealed class EnvironmentEndpointAuthenticationProvider : DockerEndpoint
1515
/// Initializes a new instance of the <see cref="EnvironmentEndpointAuthenticationProvider" /> class.
1616
/// </summary>
1717
public EnvironmentEndpointAuthenticationProvider()
18-
: this(PropertiesFileConfiguration.Instance, EnvironmentConfiguration.Instance)
18+
: this(EnvironmentConfiguration.Instance, PropertiesFileConfiguration.Instance)
1919
{
2020
}
2121

src/Testcontainers/Builders/MTlsEndpointAuthenticationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal sealed class MTlsEndpointAuthenticationProvider : TlsEndpointAuthentica
2323
/// Initializes a new instance of the <see cref="MTlsEndpointAuthenticationProvider" /> class.
2424
/// </summary>
2525
public MTlsEndpointAuthenticationProvider()
26-
: this(PropertiesFileConfiguration.Instance, EnvironmentConfiguration.Instance)
26+
: this(EnvironmentConfiguration.Instance, PropertiesFileConfiguration.Instance)
2727
{
2828
}
2929

src/Testcontainers/Builders/TlsEndpointAuthenticationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal class TlsEndpointAuthenticationProvider : DockerEndpointAuthenticationP
2323
/// Initializes a new instance of the <see cref="TlsEndpointAuthenticationProvider" /> class.
2424
/// </summary>
2525
public TlsEndpointAuthenticationProvider()
26-
: this(PropertiesFileConfiguration.Instance, EnvironmentConfiguration.Instance)
26+
: this(EnvironmentConfiguration.Instance, PropertiesFileConfiguration.Instance)
2727
{
2828
}
2929

src/Testcontainers/Configurations/TestcontainersSettings.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,34 +108,34 @@ static TestcontainersSettings()
108108
[CanBeNull]
109109
public static string DockerHostOverride { get; set; }
110110
= DockerEndpointAuthProvider is ICustomConfiguration config
111-
? config.GetDockerHostOverride() : PropertiesFileConfiguration.Instance.GetDockerHostOverride() ?? EnvironmentConfiguration.Instance.GetDockerHostOverride();
111+
? config.GetDockerHostOverride() : EnvironmentConfiguration.Instance.GetDockerHostOverride() ?? PropertiesFileConfiguration.Instance.GetDockerHostOverride();
112112

113113
/// <summary>
114114
/// Gets or sets the Docker socket override value.
115115
/// </summary>
116116
[CanBeNull]
117117
public static string DockerSocketOverride { get; set; }
118118
= DockerEndpointAuthProvider is ICustomConfiguration config
119-
? config.GetDockerSocketOverride() : PropertiesFileConfiguration.Instance.GetDockerSocketOverride() ?? EnvironmentConfiguration.Instance.GetDockerSocketOverride();
119+
? config.GetDockerSocketOverride() : EnvironmentConfiguration.Instance.GetDockerSocketOverride() ?? PropertiesFileConfiguration.Instance.GetDockerSocketOverride();
120120

121121
/// <summary>
122122
/// Gets or sets a value indicating whether the <see cref="ResourceReaper" /> is enabled or not.
123123
/// </summary>
124124
public static bool ResourceReaperEnabled { get; set; }
125-
= !PropertiesFileConfiguration.Instance.GetRyukDisabled() && !EnvironmentConfiguration.Instance.GetRyukDisabled();
125+
= !EnvironmentConfiguration.Instance.GetRyukDisabled() && !PropertiesFileConfiguration.Instance.GetRyukDisabled();
126126

127127
/// <summary>
128128
/// Gets or sets a value indicating whether the <see cref="ResourceReaper" /> privileged mode is enabled or not.
129129
/// </summary>
130130
public static bool ResourceReaperPrivilegedModeEnabled { get; set; }
131-
= PropertiesFileConfiguration.Instance.GetRyukContainerPrivileged() || EnvironmentConfiguration.Instance.GetRyukContainerPrivileged();
131+
= EnvironmentConfiguration.Instance.GetRyukContainerPrivileged() || PropertiesFileConfiguration.Instance.GetRyukContainerPrivileged();
132132

133133
/// <summary>
134134
/// Gets or sets the <see cref="ResourceReaper" /> image.
135135
/// </summary>
136136
[CanBeNull]
137137
public static IImage ResourceReaperImage { get; set; }
138-
= PropertiesFileConfiguration.Instance.GetRyukContainerImage() ?? EnvironmentConfiguration.Instance.GetRyukContainerImage();
138+
= EnvironmentConfiguration.Instance.GetRyukContainerImage() ?? PropertiesFileConfiguration.Instance.GetRyukContainerImage();
139139

140140
/// <summary>
141141
/// Gets or sets the <see cref="ResourceReaper" /> public host port.
@@ -159,7 +159,7 @@ static TestcontainersSettings()
159159
/// </remarks>
160160
[CanBeNull]
161161
public static string HubImageNamePrefix { get; set; }
162-
= PropertiesFileConfiguration.Instance.GetHubImageNamePrefix() ?? EnvironmentConfiguration.Instance.GetHubImageNamePrefix();
162+
= EnvironmentConfiguration.Instance.GetHubImageNamePrefix() ?? PropertiesFileConfiguration.Instance.GetHubImageNamePrefix();
163163

164164
/// <summary>
165165
/// Gets or sets the logger.

0 commit comments

Comments
 (0)