diff --git a/.github/workflows/azure-functions-app-python.yml b/.github/workflows/azure-functions-app-python.yml index d830694..d2783d6 100644 --- a/.github/workflows/azure-functions-app-python.yml +++ b/.github/workflows/azure-functions-app-python.yml @@ -66,7 +66,7 @@ jobs: with: app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} - publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC + publish-profile: ${{ secrets.AZFUNCTIONS_PUBLISHING_PROFILE }} # Remove publish-profile to use Azure RBAC scm-do-build-during-deployment: false enable-oryx-build: false respect-funcignore: true diff --git a/.github/workflows/azure-staticwebapp.yml b/.github/workflows/azure-staticwebapp.yml index e0c85c3..d6700b6 100644 --- a/.github/workflows/azure-staticwebapp.yml +++ b/.github/workflows/azure-staticwebapp.yml @@ -25,7 +25,7 @@ env: APP_LOCATION: "/landing" # location of your client code # API_LOCATION: "api" # location of your api source code - optional APP_ARTIFACT_LOCATION: "build" # location of client code build output - AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing deployment token for your static web app + AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.LANDING_AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing deployment token for your static web app permissions: contents: read @@ -58,7 +58,7 @@ jobs: app_build_command: 'npm run build' # Static Web App build command to embed environment variables env: # Add environment variables here REACT_APP_GA_MEASUREMENT_ID: ${{ secrets.REACT_APP_GA_MEASUREMENT_ID }} - REACT_APP_BACKEND_URL: ${{ vars.REACT_APP_BACKEND_URL }} + REACT_APP_BACKEND_URL: ${{ vars.LANDING_REACT_APP_BACKEND_URL }} REACT_APP_ENV: ${{ github.ref_name == 'main' && 'prod' || 'dev' }} # Set the node environment to enable/disable google analytics ###### End of Repository/Build Configurations ###### diff --git a/.vscode/settings.json b/.vscode/settings.json index 0f759c4..10ed831 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,6 @@ "." ], "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true + "python.testing.pytestEnabled": true, + "search.useIgnoreFiles": false } \ No newline at end of file diff --git a/infra/runtime/.terraform.lock.hcl b/infra/runtime/.terraform.lock.hcl index 2f6f2e8..80ca136 100644 --- a/infra/runtime/.terraform.lock.hcl +++ b/infra/runtime/.terraform.lock.hcl @@ -39,28 +39,6 @@ provider "registry.terraform.io/hashicorp/external" { ] } -provider "registry.terraform.io/hashicorp/github" { - version = "6.2.2" - hashes = [ - "h1:JG071kaPP49Coe6JzzqRkoWB1WaxgKHosw7Hr/3qIjw=", - "zh:43d7e5f1e11d67e38ca717016d209d6d9a6fa03321b489f91984351bfb143b69", - "zh:46e788395034b410bf59dfa43eb748a3d81ecfd23fc442349990fd7d92bd856a", - "zh:5234b7d5c5817ff7ebec29756050708372a071a701e2c8236e714a0bd29ef160", - "zh:74c485a241cc8e8cb99f988d38116fb14e51de896761fc9ca35a34ca5c999a7e", - "zh:7606789521c50937913ea13f851150828b5f9b8804ba80c5b2538c0b019339d8", - "zh:760fb0e74590459689c7159456b6e76f165634f7d0f89f5572d56b57d387f645", - "zh:7979d9085d809bb7d0db2c67e6c3443d1c18d12e51b72220dcb4cc5e883cd64a", - "zh:8bed25d8199bf8b2e7ccf67edc1a4a2fc041bd490b2c11565c669b80be43896c", - "zh:9ff82a6279fb7ae0cd9e44f1e73b64dd2aeca43d4d3096f3f2866b1ebbcb9431", - "zh:a886055ecd63ccb9b880e3c3301c0eca9acb108580d12519617554ae2be9a393", - "zh:c1f20386704919c7964a95daffcb29f494efb061abc28469840df4532833cecf", - "zh:cb6e9c4e33d6a57770073867e174c09c0eed401ee70473a688d20cb1cf0394f7", - "zh:f89ca130cc90b87dc25d036fe8f8cadb6fb53dc33368a032c5cee6275f3bcddc", - "zh:f94a2d1174091f04ed361192cdda9503baa3d161849d4f218c55a96bfb1ea33d", - "zh:fbd1fee2c9df3aa19cf8851ce134dea6e45ea01cb85695c1726670c285797e25", - ] -} - provider "registry.terraform.io/integrations/github" { version = "6.2.2" constraints = "~> 6.0" diff --git a/infra/runtime/github_actions_secrets.tf b/infra/runtime/github_actions_secrets.tf index 02bb477..913344b 100644 --- a/infra/runtime/github_actions_secrets.tf +++ b/infra/runtime/github_actions_secrets.tf @@ -1,4 +1,5 @@ -data "external" "publishing_profile" { +# get landing_publishing_profile +data "external" "landing_publishing_profile" { program = ["powershell", "-File", "./fetch_publishing_profile.ps1", azurerm_linux_function_app.landing_backend.name, azurerm_resource_group.rg.name] # No input is required, so this can be an empty map @@ -7,7 +8,20 @@ data "external" "publishing_profile" { # Convert the publishing profile from JSON string to raw string locals { - publishing_profile = data.external.publishing_profile.result.publishing_profile + landing_publishing_profile = data.external.landing_publishing_profile.result.publishing_profile +} + +# get azfunctions_publishing_profile +data "external" "azfunctions_publishing_profile" { + program = ["powershell", "-File", "./fetch_publishing_profile.ps1", azurerm_linux_function_app.resumematchpro.name, azurerm_resource_group.rg.name] + + # No input is required, so this can be an empty map + query = {} +} + +# Convert the publishing profile from JSON string to raw string +locals { + azfunctions_publishing_profile = data.external.azfunctions_publishing_profile.result.publishing_profile } data "github_repository" "repo" { @@ -23,7 +37,28 @@ resource "github_actions_environment_secret" "LANDING_BACKEND_PUBLISHING_PROFILE repository = data.github_repository.repo.name environment = github_repository_environment.repo_environment.environment secret_name = "LANDING_BACKEND_PUBLISHING_PROFILE" - plaintext_value = local.publishing_profile + plaintext_value = local.landing_publishing_profile +} + +resource "github_actions_environment_secret" "AZFUNCTIONS_PUBLISHING_PROFILE" { + repository = data.github_repository.repo.name + environment = github_repository_environment.repo_environment.environment + secret_name = "AZFUNCTIONS_PUBLISHING_PROFILE" + plaintext_value = local.azfunctions_publishing_profile +} + +resource "github_actions_environment_secret" "LANDING_AZURE_STATIC_WEB_APPS_API_TOKEN" { + repository = data.github_repository.repo.name + environment = github_repository_environment.repo_environment.environment + secret_name = "LANDING_AZURE_STATIC_WEB_APPS_API_TOKEN" + plaintext_value = azurerm_static_web_app.landingpage.api_key +} + +resource "github_actions_environment_variable" "LANDING_REACT_APP_BACKEND_URL" { + repository = data.github_repository.repo.name + environment = github_repository_environment.repo_environment.environment + variable_name = "LANDING_REACT_APP_BACKEND_URL" + value = "https://${azurerm_linux_function_app.landing_backend.default_hostname}/api" } # data "github_repository" "repo" { diff --git a/landing/src/services/contactService.js b/landing/src/services/contactService.js index 476ce73..c0291b8 100644 --- a/landing/src/services/contactService.js +++ b/landing/src/services/contactService.js @@ -1,5 +1,5 @@ export const submitContactDetails = async (contactDetails) => { - const backendUrl = process.env.REACT_APP_BACKEND_URL; + const backendUrl = process.env.LANDING_REACT_APP_BACKEND_URL; try { const response = await fetch(`${backendUrl}/contact_details`, { method: 'POST',