|
966 | 966 | } |
967 | 967 |
|
968 | 968 | $wg = new WaitGroup(); |
969 | | - $envNames = []; |
| 969 | + $envs = []; |
970 | 970 | foreach ($files as $file) { |
971 | 971 | if (!(\str_starts_with($file, '.env'))) { |
972 | 972 | continue; |
973 | 973 | } |
974 | 974 |
|
975 | 975 | $wg->add(); |
976 | | - go(function () use ($github, $owner, $repositoryName, $providerRootDirectory, $file, $wg, &$envNames) { |
| 976 | + go(function () use ($github, $owner, $repositoryName, $providerRootDirectory, $file, $wg, &$envs) { |
977 | 977 | try { |
978 | 978 | $contentResponse = $github->getRepositoryContent($owner, $repositoryName, \rtrim($providerRootDirectory, '/') . '/' . $file); |
979 | 979 | $envFile = $contentResponse['content'] ?? ''; |
|
982 | 982 | foreach ($envLines as $line) { |
983 | 983 | $parts = \explode('=', $line, 2); |
984 | 984 | $envName = \trim($parts[0] ?? ''); |
| 985 | + $envValue = \trim($parts[1] ?? ''); |
985 | 986 | if (!empty($envName)) { |
986 | | - $envNames[] = $envName; |
| 987 | + $envs[$envName] = $envValue; |
987 | 988 | } |
988 | 989 | } |
989 | 990 | } finally { |
|
993 | 994 | } |
994 | 995 | $wg->wait(); |
995 | 996 |
|
996 | | - $output->setAttribute('variables', \array_unique($envNames)); |
| 997 | + $variables = []; |
| 998 | + foreach ($envs as $key => $value) { |
| 999 | + $variables[] = [ |
| 1000 | + 'name' => $key, |
| 1001 | + 'value' => $value, |
| 1002 | + ]; |
| 1003 | + } |
| 1004 | + |
| 1005 | + $output->setAttribute('variables', $variables); |
997 | 1006 |
|
998 | 1007 | $response->dynamic($output, $type === 'framework' ? Response::MODEL_DETECTION_FRAMEWORK : Response::MODEL_DETECTION_RUNTIME); |
999 | 1008 | }); |
|
1171 | 1180 | } |
1172 | 1181 |
|
1173 | 1182 | $wg = new WaitGroup(); |
1174 | | - $envNames = []; |
| 1183 | + $envs = []; |
1175 | 1184 | foreach ($files as $file) { |
1176 | 1185 | if (!(\str_starts_with($file, '.env'))) { |
1177 | 1186 | continue; |
1178 | 1187 | } |
1179 | 1188 |
|
1180 | 1189 | $wg->add(); |
1181 | | - go(function () use ($github, $repo, $file, $wg, &$envNames) { |
| 1190 | + go(function () use ($github, $repo, $file, $wg, &$envs) { |
1182 | 1191 | try { |
1183 | 1192 | $contentResponse = $github->getRepositoryContent($repo['organization'], $repo['name'], $file); |
1184 | 1193 | $envFile = $contentResponse['content'] ?? ''; |
|
1187 | 1196 | foreach ($envLines as $line) { |
1188 | 1197 | $parts = \explode('=', $line, 2); |
1189 | 1198 | $envName = \trim($parts[0] ?? ''); |
| 1199 | + $envValue = \trim($parts[1] ?? ''); |
1190 | 1200 | if (!empty($envName)) { |
1191 | | - $envNames[] = $envName; |
| 1201 | + $envs[$envName] = $envValue; |
1192 | 1202 | } |
1193 | 1203 | } |
1194 | 1204 | } finally { |
|
1198 | 1208 | } |
1199 | 1209 | $wg->wait(); |
1200 | 1210 |
|
1201 | | - $repo['variables'] = \array_unique($envNames); |
| 1211 | + $repo['variables'] = []; |
| 1212 | + foreach ($envs as $key => $value) { |
| 1213 | + $repo['variables'][] = [ |
| 1214 | + 'name' => $key, |
| 1215 | + 'value' => $value, |
| 1216 | + ]; |
| 1217 | + } |
1202 | 1218 |
|
1203 | 1219 | return $repo; |
1204 | 1220 | }; |
|
0 commit comments