@@ -48,42 +48,42 @@ private function __construct(
4848 * Loading order (later overrides earlier):
4949 * 1. Profile from TOML file (if $configFile provided, or TEMPORAL_CONFIG_FILE is set,
5050 * or file exists at default platform-specific location)
51- * 2. Environment variable overrides (if $envProvider provided)
51+ * 2. Environment variable overrides (if $env provided)
5252 *
5353 * @param non-empty-string|null $profileName Profile name to load. If null, uses TEMPORAL_PROFILE
5454 * environment variable or 'default' as fallback.
5555 * @param non-empty-string|null $configFile Path to TOML config file or TOML content string.
5656 * If null, checks TEMPORAL_CONFIG_FILE env var, then checks if file exists at
5757 * default platform-specific location.
58- * @param EnvProvider $envProvider Environment variable provider for overrides.
59- * @param bool $strict Whether to use strict TOML parsing (validates mutual exclusivity, etc.)
58+ * @param array $env Environment variables array for overrides.
6059 *
6160 * @throws ProfileNotFoundException If the requested profile is not found
6261 * @throws InvalidConfigException If configuration file is invalid
6362 */
6463 public static function load (
6564 ?string $ profileName = null ,
6665 ?string $ configFile = null ,
67- EnvProvider $ envProvider = new SystemEnvProvider (),
68- bool $ strict = true ,
66+ array $ env = [],
6967 ): self {
68+ $ env = $ env ?: \getenv ();
69+
7070 // Load environment config first to get profile name if not specified
71- $ envConfig = ConfigEnv::fromEnvProvider ( $ envProvider );
71+ $ envConfig = ConfigEnv::fromEnv ( $ env );
7272 $ profileName ??= $ envConfig ->currentProfile ?? 'default ' ;
7373 $ profileNameLower = \strtolower ($ profileName );
7474
7575 // Determine config file path: explicit > env var > default location
7676 $ configFile ??= $ envConfig ->configFile ;
7777 if ($ configFile === null ) {
78- $ configFile = self ::getDefaultConfigPath ($ envProvider );
78+ $ configFile = self ::getDefaultConfigPath ($ env );
7979 $ configFile === null or \file_exists ($ configFile ) or $ configFile = null ;
8080 }
8181
8282 // Load from file if it exists
8383 $ profile = null ;
8484 $ profiles = [];
8585 if ($ configFile !== null ) {
86- $ profiles = self ::loadFromToml ($ configFile, $ strict )->profiles ;
86+ $ profiles = self ::loadFromToml ($ configFile )->profiles ;
8787 $ profile = $ profiles [$ profileNameLower ] ?? null ;
8888 }
8989
@@ -109,11 +109,13 @@ public static function load(
109109 *
110110 * Uses TEMPORAL_* environment variables to construct configuration.
111111 *
112- * @param EnvProvider $envProvider Environment variable provider .
112+ * @param array $env Environment variables array .
113113 */
114- public static function loadFromEnv (EnvProvider $ envProvider = new SystemEnvProvider () ): self
114+ public static function loadFromEnv (array $ env = [] ): self
115115 {
116- $ envConfig = ConfigEnv::fromEnvProvider ($ envProvider );
116+ $ env = $ env ?: \getenv ();
117+
118+ $ envConfig = ConfigEnv::fromEnv ($ env );
117119 $ profileName = $ envConfig ->currentProfile ?? 'default ' ;
118120
119121 return new self ([$ profileName => $ envConfig ->profile ]);
@@ -214,20 +216,20 @@ private static function normalizeProfileNames(array $profiles): array
214216 * Note: This method returns the expected path regardless of whether the file exists.
215217 * The caller is responsible for checking file existence.
216218 *
217- * @param EnvProvider $envProvider Environment variable provider
219+ * @param array $env Environment variables array
218220 * @return non-empty-string|null Path to default config file, or null if home directory cannot be determined
219221 */
220- private static function getDefaultConfigPath (EnvProvider $ envProvider ): ?string
222+ private static function getDefaultConfigPath (array $ env ): ?string
221223 {
222- $ home = $ envProvider -> get ( 'HOME ' ) ?? $ envProvider -> get ( 'USERPROFILE ' ) ;
224+ $ home = $ env [ 'HOME ' ] ?? $ env [ 'USERPROFILE ' ] ?? null ;
223225 if ($ home === null ) {
224226 return null ;
225227 }
226228
227229 $ configDir = match (\PHP_OS_FAMILY ) {
228- 'Windows ' => $ envProvider -> get ( 'APPDATA ' ) ?? ($ home . '\\AppData \\Roaming ' ),
230+ 'Windows ' => $ env [ 'APPDATA ' ] ?? ($ home . '\\AppData \\Roaming ' ),
229231 'Darwin ' => $ home . '/Library/Application Support ' ,
230- default => $ envProvider -> get ( 'XDG_CONFIG_HOME ' ) ?? ($ home . '/.config ' ),
232+ default => $ env [ 'XDG_CONFIG_HOME ' ] ?? ($ home . '/.config ' ),
231233 };
232234
233235 return $ configDir . \DIRECTORY_SEPARATOR . 'temporalio ' . \DIRECTORY_SEPARATOR . 'temporal.toml ' ;
0 commit comments