Skip to content

Update .environment with Fastly credentials - #118

Open
dman-coders wants to merge 1 commit into
platformsh-templates:mainfrom
dman-coders:patch-1
Open

Update .environment with Fastly credentials#118
dman-coders wants to merge 1 commit into
platformsh-templates:mainfrom
dman-coders:patch-1

Conversation

@dman-coders

Copy link
Copy Markdown

Set Fastly credentials automatically from the environment

Description

On Upsun hosting we provide $FASTLY_API_SERVICE as an environment variable.
This needs to be absorbed by the Magento app to be different in production and staging
Magento allows setting overrides with carefully structured environment variables.
https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/paths/override-config-settings

This change maps the conventional $FASTLY_API_SERVICE and $FASTLY_API_TOKEN to the Magento-specific format

Related Issue

Support setting Fastly API credentials directly from environment context. #117
#117
https://app.getguru.com/card/TGzyd45c/Magento2-onboarding#POhv8tRnfC3j

Motivation and Context

There is a high risk that syncing the DB state from production to staging will mean that staging has access to the production Fastly service, and may publish vcl updates from test to live inadvertently.

How Has This Been Tested?

  • Deployed todays magentoCE24 on a clean Upsun project
  • Set FASTLY_API_SERVICE, FASTLY_API_TOKEN as environment variables via CLI
  • Verified that the running Magento app did not have access to these tokens
    bin/magento config:show | grep fastly
  • Applied this addition to the .environment file and redeployed.
  • After redeployment, verified that these settings had been absorbed into the Magento (core_config_data) as system/full_page_cache/fastly/fastly_service_id
  • The Magento/Fastly module now has access to the API with the right credentials.
    (did not use an actual Fastly service for this test)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Go over all the following list, and put an x in all the boxes that apply. If you're unsure about what any of these mean, don't hesitate to ask. We're here to help!

  • I have read the contribution guide
  • I have created an issue following the issue guide
  • My code follows the code style of this project.
  • [?] My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Add environment variables for Fastly API credentials.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant