elixis-group/gcp-secret-manager-bundle
Composer 安装命令:
composer require elixis-group/gcp-secret-manager-bundle
包简介
Use GCP Secrets as service container parameters in Symfony, and provided provider class to access secrets value.
README 文档
README
Version 2.0.2 Created 2021/08/12 Last Update 2023/12/05
Use GCP Secrets as service container parameters in Symfony, and provided provider class to access secrets value.
Prerequisites
Configure Secret Manager in your project Google Cloud, see following article who explain how create and configure Google Secret Manager https://cloud.google.com/secret-manager/docs/configuring-secret-manager.
Warning in local dev environment, you need create a service account to set global var GOOGLE_APPLICATION_CREDENTIALS. See https://cloud.google.com/iam/docs/service-accounts#user-managed.
Installation
Warning ! Befor install bundle, a minimal configuration is required. Google Secret Manager need a global var GOOGLE_APPLICATION_CREDENTIALS.
Create file config/packages/gcp_secret_manager.yaml and add the following.
#config/packages/gcp_secret_manager.yaml
gcp_secret_manager:
secret_manager_client_config:
keyfilepath: '%kernel.project_dir%/google_application_credentials.json' # Google Credentials path
$ composer require gcp-secret-manager-bundle
Activating GCP Secret Manager Bundle.
#config/bundles.php
ElixisGroup\GcpSecretManagerBundle\GcpSecretManagerBundle::class => ['all' => true],
Configuration
By default, configuration for this bundle is loaded from config/packages/gcp_secret_manager.yaml file or its environment specific.
The following configuration properties are available:
#config/packages/gcp_secret_manager.yaml
gcp_secret_manager:
secret_manager_client_config:
project_id: 'projectId' # Google Cloud project id
keyfilepath: '%kernel.project_dir%/google_application_credentials.json' # Google Credentials path
delimiter: ':' # Delimiter to separate secret name from secret version
ignore: false # Pass through GCP Secret Manager (if you don't use set to "true").
Default usage
Set an env var to an AWS Secret Manager Secret name and Secret version separate by the separator define in config or the default one, like so:
#.env
SECRET_ENV_VAR=SECRET_NAME:SECRET_VERSION
Set a parameter to this environment variable with the gcp processor:
#config/services.yaml
parameters:
secret_env_var: '%env(gcp:SECRET_ENV_VAR)%'
Service Container Usage
A standalone service container is also available if you don't want use a service container parameters.
#Controller/AcmeController.php
use ElixisGroup\GcpSecretManagerBundle\Provider\GcpSecretManagerProvider;
class AcmeController extends AbstractController
{
public function index(GcpSecretManagerProvider $secretProvider){
$secretValue = $secretProvider->get('SECRET_NAME', SECRET_VERSION);
}
}
Examples
elixis-group/gcp-secret-manager-bundle 适用场景与选型建议
elixis-group/gcp-secret-manager-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 609 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 12 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「env」 「google cloud」 「gcp」 「Secrets Manager」 「GOOGLE CLOUD PLATFOM」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 elixis-group/gcp-secret-manager-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elixis-group/gcp-secret-manager-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 elixis-group/gcp-secret-manager-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
An environment variable convenience library extension for vlucas/phpdotenv
Laravel dotenv manager
Bundle Symfony DaplosBundle
Utils to load, parse and work with configuration on Mezzio projects
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
统计信息
- 总下载量: 609
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-13