Skip to content

Commit

Permalink
added cors settings
Browse files Browse the repository at this point in the history
  • Loading branch information
babakamyljanovssw committed Oct 28, 2024
1 parent 3d53736 commit ff5dbcb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Azure/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ff5dbcb

Please sign in to comment.