etracksystems/laravel-docker-secrets 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

etracksystems/laravel-docker-secrets

最新稳定版本:v4.0

Composer 安装命令:

composer require etracksystems/laravel-docker-secrets

包简介

Use Docker Swarm Secrets in your Laravel config files

README 文档

README

Latest Version on Packagist Total Downloads Build

This package, which was forked from corbosman/laravel-docker-secrets, allows you to use docker swarm secrets in your Laravel config files. Note there are some limitations, see the usage below.

Installation

Via Composer

$ composer require etracksystems/laravel-docker-secrets

Usage

This package provides two helper methods that you can use in your laravel config files. Due to the way Laravel parses the config files, you can only use them in the env() method. In practice this is almost always exactly what you want, as it allows you to override the secrets locally for development.

<?php
    return [
        'password' => env('PASSWORD', docker_secret('my-docker-secret'))
    ];
?>   

You can also store encrypted docker secrets. Note that the secret must be encrypted using your app's key. This is useful if you share your swarm with a team. Other projects can't just mount your secrets and view them.

<?php
    return [
        'password' => env('PASSWORD', docker_secret_encrypted('my-encrypted-docker-secret'))
    ];
?>   

Finally, you can also return a default value if the secret isn't available.

<?php
    return [
        'password' => env('PASSWORD', docker_secret_encrypted('my-docker-secret', 'my-default'))
    ];
?>      

Creating encrypted secret

This package offers a command to easily generate an encrypted secret which you can then store in Docker Swarm. It uses the project's app secret for encryption so make sure that this same key is also used in the service that uses the Swarm secret. You can also simply use Tinker to create encrypted secrets.

$ artisan docker-secret:encrypt foobar
eyJpdiI6ImY5dWdHeHJ2WkpZdUNTZFlVYUZpMFE9PSIsInZhbHVlIjoidmZPblk2eEIxNy8vdkl6OE5YSGF2dz09IiwibWFjIjoiZTdmYmVmNmQ5YzA5ZTI3YzI0NjFjOGJkOTY5ODhjNDkwMmMwYWVmMTkwYzcyNzMzN2ZlYWQ1NzlhNzlkM2RjZCJ9

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

  • Cor Bosman - original author of the corbosman/laravel-docker-secrets packages which this was forked from.

License

Please see the license file for more information.

统计信息

  • 总下载量: 1.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-08