Closed tomaszkane closed 6 months ago
Please update a README with something like: "This works only for main/root/business composer.json file." https://github.com/yiisoft/config#environments
@tomaszkane I created PR with note.
Seems, this case is valid. Packages may be related to application layer. Add ability set environments in such packages looks as good idea. I think, we can add environments support to packages from vendor-override-layer, but not to all packages.
Now you can try use so approach to resolve your task:
"extra": {
"config-plugin-options": {
"source-directory": "config"
},
"config-plugin": {
"yii2-api": "yii2-api.php",
"yii2-api-prod": "prod/yii2-api.php",
"yii2-api-dev": "dev/yii2-api.php",
},
},
"extra": {
"config-plugin-environments": {
"dev": {
"yii2-api": [
"$yii2-api-dev",
"dev/yii2-api.php"
],
},
"prod": {
"yii2-api": [
"$yii2-api-prod",
"prod/yii2-api.php"
]
}
}
},
Could you try with:
"config-plugin": {
"di": "yii2-api.php"
},
"config-plugin-environments": {
"dev": {
"di": [
"$di",
"dev/yii2-api.php"
]
},
"prod": {
"di": [
"$di",
"prod/yii2-api.php"
]
}
}
?
I think it works for me. Thanks.
What steps will reproduce the problem?
Define config file for given environment, like "dev", "prod" etc. https://github.com/yiisoft/config#environments but in
composer.json
located invendor
directory.What is the expected result?
For vendor composer like:
Config called in root project return
dev
configs also from "vendors".What do you get instead?
Environment config from "vendor" projects (repositories/packages) is not present in
.merge-plan
.Additional info
I develop a project-template based on Yii2 who's using several packages via composer and want to have all configs of this packages in package repository - thanks to that
composer install/update
will fully configure my application. Some of my packeges sohuld use different params/configs based on environemtns, like: disable "https / secure" in dev and test environments. Set "sandbox" or "production" to payment-provide package etc.It's possible to achieve that? Or how to do it better/different?