imdigital / magento-serverless-gcp
将 Google Cloud 函数添加到无服务器框架
1.0.1
2023-03-14 17:48 UTC
Requires
- php: >=8.1
- google/cloud-functions: ^1.0
- grpc/grpc: ^1.38
- imdigital/magento-serverless: ^1.0.3
This package is auto-updated.
Last update: 2024-09-14 20:55:59 UTC
README
为 Magento 2 无服务器框架提供 Google Cloud Functions
此 Magento 模块将扩展Magento 2 无服务器框架模块,允许我们使用 Google Cloud Functions。
安装
要求
- Magento >= 2.4.5-p1
- PHP >= 8.1
- PHP 的 Grpc
安装模块并启用它
要安装此模块,必须运行 composer require 命令请求安装
composer require imdigital/magento-serverless-gcp
然后,通过修改 app/etc/config.php 或运行 CLI 命令来启用它
php bin/magento module:enable ImDigital_ServerlessGcp
无服务器函数设置
当将新的无服务器函数添加到 serverless_functions 数据库表时,必须在 cloud_provider 字段中使用 gcp 作为云提供商代码。
云配置字段期望一个此格式的(加密)JSON
{ "region_id": "us-central1", "serviceaccount_key": { "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://#/o/oauth2/auth", "client_email": "my-service-account-email", "client_id": "my-client-id", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/my-cert-url", "private_key": "my-private-key", "private_key_id": "my-private-key-id", "project_id": "my-gcp-project-id", "token_uri": "https://oauth2.googleapis.com/token", "type": "service_account" } }
region_id 是云函数所在区域。 serviceaccount_key 字段是我们必须创建的 服务帐户,然后 生成一个 JSON 服务帐户密钥,以便执行函数。
这些是你必须添加到服务帐户的权限,以便能够执行云函数