vijoni/config-builder
Composer 安装命令:
composer require vijoni/config-builder
包简介
Structure config files for different environments and merge them to a single php file. Supports files encrypted with git-crypt key files
README 文档
README
Build a php environment specific configuration file based on organized template config files.
Usage
Check acceptance tests for more details
Sample file structure:

Sample configuration file contents (not encrypted)
// default.yaml
---
config:
enable_checkout_payment_experiment: true
database:
host: ${DATABASE_HOST}
pass: ${DATABASE_PASS}
user: ${DATABASE_USER}
name: ${DATABASE_NAME}
// prod/config.yaml
---
extends:
- '../default.yaml'
- '../_shared/experiments.yaml'
config:
Build a key file from a base64 encoded git-crypt file contents provided as environment variable:
echo $DEFAULT_GC_KEY | bin/decode-gckey -o /tmp/git-crypt-default.key
echo $PROD_GC_KEY | bin/decode-gckey -o /tmp/git-crypt-prod.key
Build configuration file.
If -k argument is omitted script will not use decryption. \
Command accepts multiple git-crypt key file paths. \
If none of the provided key files is able to decrypt a file, command will exit with an error. \
The command reads environment variables to replace template's placeholder literals.
bin/build-config \
-k /tmp/git-crypt-default.key \
-k /tmp//git-crypt-prod.key \
-c environments/prod/config.yaml \
-o config/config.php
Templates
Templates can contain placeholder literals ${VAR_NAME},
which during the build process will be replaced with corresponding values.
You can organize your configuration in multiple files.
Use the extends key to specify additional files.
The files on the bottom of the list will override the values provided in the files above.
Values provided in the config key will override the values coming from extended files.
YAML, JSON, PHP templates are supported. Check acceptance tests for sample configuration files.
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-01