diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f624c6..53f25bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.AZ_FUNC_GITHUB_PAT}} CMS_OAUTH_CLIENT_ID: ${{ secrets.STAGING_CMS_OAUTH_CLIENT_ID }} CMS_OAUTH_CLIENT_SECRET: ${{ secrets.STAGING_CMS_OAUTH_CLIENT_SECRET }} + CORS_ORIGINS: ${{ secrets.STAGING_CORS_ORIGINS }} - name: Login with Azure CLI uses: azure/login@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7134f8e..a22cdcd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,6 +59,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.AZ_FUNC_GITHUB_PAT}} CMS_OAUTH_CLIENT_ID: ${{ secrets.CMS_OAUTH_CLIENT_ID }} CMS_OAUTH_CLIENT_SECRET: ${{ secrets.CMS_OAUTH_CLIENT_SECRET }} + CORS_ORIGINS: ${{ secrets.STAGING_CORS_ORIGINS }} - name: Login with Azure CLI uses: azure/login@v2 diff --git a/Azure/Program.fs b/Azure/Program.fs index 51ccf2f..6a3c5d2 100644 --- a/Azure/Program.fs +++ b/Azure/Program.fs @@ -8,7 +8,8 @@ let mutable namePrefix = Environment.GetEnvironmentVariable "AZURE_RG_PREFIX" let gitHubToken = Environment.GetEnvironmentVariable "GITHUB_TOKEN" let cmsOAuthClientId = Environment.GetEnvironmentVariable "CMS_OAUTH_CLIENT_ID" let cmsOAuthClientSecret = Environment.GetEnvironmentVariable "CMS_OAUTH_CLIENT_SECRET" - +let corsOrigins = Environment.GetEnvironmentVariable("CORS_ORIGINS") + |> fun origins -> origins.Split(',') |> Array.toList if isNull namePrefix then namePrefix <- "sswrules-local" @@ -36,6 +37,8 @@ let myFunctions = functions { setting "CosmosDb:Account" myCosmosDb.Endpoint setting "CosmosDb:Key" myCosmosDb.PrimaryKey setting "CosmosDb:DatabaseName" myCosmosDb.DbName + + enable_cors corsOrigins } let deployment = arm {