EventHub-Emulator/Scripts/Windows/LaunchEmulator.ps1 (38 lines of code) (raw):

param( [string]$ACCEPT_EULA='n', [string]$CONFIG_PATH='../EventHub-Emulator/Config/Config.json' ) Write-Warning "As running native .ps1 script required updating your machine's execution policy, the .ps1 script will be phased out by June 2025. To mitigate this, please transition to running .sh script via WSL on Windows. You can find the Launchemulator.sh script in the Common folder: https://github.com/Azure/azure-event-hubs-emulator-installer/blob/main/ServiceBus-Emulator/Scripts/Common/LaunchEmulator.sh" # For dynamic ports and support communication to host network use the commentted docker compose file path instead. # composeFile=$(realpath "$(dirname "$BASH_SOURCE")/../../../Docker-Compose-Template/docker-compose-custom-ports-windows-mac.yaml") $composeFile = Join-Path $PSScriptRoot "/../../../Docker-Compose-Template/docker-compose-default.yml" if ($PSBoundParameters.ContainsKey('ACCEPT_EULA')) { if ($ACCEPT_EULA -ne 'y' -and $ACCEPT_EULA -ne 'Y') { Write-Host "You must accept the EULA (Pass --ACCEPT_EULA 'Y' parameter to the script) to continue. Exiting script." exit } } else{ # EULA $ACCEPT_EULA = Read-Host 'By pressing "Y", you are expressing your consent to the End User License Agreement (EULA) for Event-Hubs Emulator: https://github.com/Azure/azure-event-hubs-emulator-installer/blob/main/EMULATOR_EULA.md' if ($ACCEPT_EULA -ne 'y' -and $ACCEPT_EULA -ne 'Y') { Write-Host "You must accept the EULA (Press 'Y') to continue. Exiting script." exit } } # Set EULA as env variable Write-Host "EULA has been accepted. Proceeding with launching containers.." $env:ACCEPT_EULA = $ACCEPT_EULA # Set Config Path as env variable $env:CONFIG_PATH = $CONFIG_PATH # Run Docker Compose docker compose -f $composeFile down docker compose -f $composeFile up -d if ($LASTEXITCODE -ne 0) { Write-Output "An error occurred while running docker compose.Exiting the script." exit 1 } Write-Host "Emulator Service and dependencies have been successfully launched!" -ForegroundColor Green