$servicesDir = "d:\FzxBDSH\services" $services = Get-ChildItem -Path $servicesDir -Directory foreach ($service in $services) { $configFile = Join-Path -Path $service.FullName -ChildPath "src\main\resources\application.yml" if (Test-Path -Path $configFile) { Write-Host "Fixing: $($service.Name)" $content = Get-Content -Path $configFile -Raw $content = $content -replace 'jdbc:mariadb://fzx-local-mariadb:3306', 'jdbc:mariadb://${DB_HOST:mariadb}:3306' $content = $content -replace 'host: \$\{SPRING_REDIS_HOST:fzx-local-redis\}', 'host: ${SPRING_REDIS_HOST:${REDIS_HOST:redis}}' $content = $content -replace 'password: \$\{SPRING_DATASOURCE_PASSWORD:\}', 'password: ${SPRING_DATASOURCE_PASSWORD:fzx@2024!dev}' $content = $content -replace 'password: \$\{SPRING_REDIS_PASSWORD:\}', 'password: ${SPRING_REDIS_PASSWORD:fzx@2024!dev}' Set-Content -Path $configFile -Value $content -NoNewline Write-Host " Fixed" } } Write-Host "" Write-Host "=== All config files updated ===" Write-Host "You can now use DB_HOST and REDIS_HOST environment variables"