sadok-f / docker-secrets
Simple PHP library to read docker secrets.
Installs: 39 307
Dependents: 3
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.5.9
Requires (Dev)
- codeclimate/php-test-reporter: 0.4.4
- phpunit/phpunit: 4.2.*
This package is auto-updated.
Last update: 2024-12-11 19:57:08 UTC
README
Docker Secrets
A simple PHP library to read docker secrets from a Swarm cluster.
Installation
composer require sadok-f/docker-secrets
Usage
Read All
$dockerSecrets = new DockerSecrets\Reader\SecretsReader(); $allSecrets = $dockerSecrets->readAll();
return:
Array
(
[my_secret_data_1] => testSecretDataContent1
[my_secret_data_2] => testSecretDataContent2
)
Read a single secret
$dockerSecrets = new DockerSecrets\Reader\SecretsReader(); $dockerSecrets->read('my_secret');
Custom Location
The default location for secrets folder is to /run/secrets/
in Linux containers.
if you're using Docker 17.06 and higher with custom location you can use the library like this example:
$dockerSecrets = new DockerSecrets\Reader\SecretsReader('/var/myCustomLocation'); $dockerSecrets->read('my_secret');
Read secrets in Windows containers
$dockerSecrets = new DockerSecrets\Reader\SecretsReader('C:\ProgramData\Docker\secrets'); $dockerSecrets->read('my_secret');
PHPUnit
./vendor/bin/phpunit