fix(deploy): 跨域来源未配置时默认放行
This commit is contained in:
@@ -6,16 +6,18 @@ New-Item -ItemType Directory -Path $tempDir | Out-Null
|
||||
try {
|
||||
$path = Join-Path $tempDir 'test.env'
|
||||
[System.IO.File]::WriteAllText($path, "CONFIG_PUBLIC_API_BASE_URL=https://zaowua.com/api`n")
|
||||
$before = Get-Content $path -Raw
|
||||
Initialize-SecurityOrigin -Path $path
|
||||
$content = Get-Content $path -Raw
|
||||
if ((Get-PublicEnvValue $content 'CONFIG_SECURITY_ORIGIN') -ne 'https://zaowua.com') { throw 'Missing origin was not initialized' }
|
||||
if ((Get-PublicEnvValue $content 'CONFIG_SECURITY_ORIGIN')) { throw 'Missing origin was unexpectedly initialized' }
|
||||
if ($content -ne $before) { throw 'Missing origin changed the environment' }
|
||||
$before = $content
|
||||
Initialize-SecurityOrigin -Path $path
|
||||
if ((Get-Content $path -Raw) -ne $before) { throw 'Repeated initialization changed the environment' }
|
||||
|
||||
[System.IO.File]::WriteAllText($path, "CONFIG_PUBLIC_API_BASE_URL=https://zaowua.com/api`nCONFIG_SECURITY_ORIGIN=http://127.0.0.1,http://localhost`n")
|
||||
Initialize-SecurityOrigin -Path $path
|
||||
if ((Get-PublicEnvValue (Get-Content $path -Raw) 'CONFIG_SECURITY_ORIGIN') -ne 'https://zaowua.com') { throw 'Sample origin was not migrated' }
|
||||
if ((Get-PublicEnvValue (Get-Content $path -Raw) 'CONFIG_SECURITY_ORIGIN')) { throw 'Sample origin was not cleared' }
|
||||
|
||||
[System.IO.File]::WriteAllText($path, "CONFIG_PUBLIC_API_BASE_URL=https://zaowua.com/api`nCONFIG_SECURITY_ORIGIN=https://zaowua.com,https://www.zaowua.com`n")
|
||||
$before = Get-Content $path -Raw
|
||||
|
||||
Reference in New Issue
Block a user