nohnaimer / yii2-vault-client
This extension client for Hashicorp Vault backend.
Installs: 18
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.1
- ext-json: *
- yiisoft/yii2: >=2.0.13
- yiisoft/yii2-httpclient: 2.0.*
Requires (Dev)
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-10-09 17:51:48 UTC
README
This extension client for Hashicorp Vault.
Installation
The preferred way to install this extension through composer.
You can set the console
~$ composer require "nohnaimer/yii2-vault-client" --prefer-dist
or add
"require": {
"nohnaimer/yii2-vault-client": "0.1.*"
}
in require
section in composer.json
file.
Configuration
For store php-fpm environment variables from system (macOS, Linux, Unix) need to uncomment clear_env = no string in /etc/php/php-fpm.d/www.conf
Need add environment variables:
VAULT_ADDR=https://vault.url/ VAULT_TOKEN=token VAULT_KV_PATH=/kv
docker-compose example:
... php: image: php:latest container_name: php restart: on-failure working_dir: /var/www environment: VAULT_ADDR: https://127:0:0:1:8200/ VAULT_TOKEN: hvs.hrpvk3rEpD2HaHckeb976Ppw volumes: - .:/var/www:cached depends_on: - postgres ...
Use yii2 migrations
class m221103_161325_vault_init extends Migration { /** * {@inheritdoc} */ public function safeUp() { $client = new Client([ 'url' => 'url', 'token' => 'token', ]); $kv = new KVv1([ 'path' => '/kv', 'client' => $client, ]); //add $kv->post('/my/secret', ['key' => 'value']); //delete $kv->delete('/my/secret/key'); } }
License
yii2-vault-client it is available under a BSD 3-Clause License. Detailed information can be found in the LICENSE.md
.