Add api key finder class and related configurations #386
+87
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new mechanism for resolving API keys in the
shopify-app
configuration. The changes include the addition of a new class and interface for finding the current API key, modifications to the existing utility function to support this new mechanism, and updates to the configuration file to allow for the use of a resolver class.The driving force behind this PR is that the current method of a callback/closure will break the serialization of the configs so they can not be cached.
Key changes include:
New API Key Finder Mechanism:
CurrentApiKeyFinder
class to handle the resolution of API keys based on the shop domain. (src/ApiKeyFinder/CurrentApiKeyFinder.php
)CurrentApiKeyFinderInterface
to define the contract for the API key finder. (src/Contracts/CurrentApiKeyFinderInterface.php
)Updates to Utility Function:
getShopifyConfig
function to use the newconfig_api_class
for resolving API keys if defined. (src/Util.php
)Configuration File Updates:
shopify-app.php
to configure theconfig_api_class
and explain its usage. (src/resources/config/shopify-app.php
) [1] [2]