我已经在 heroku 上设置了一个具有持续部署 (travis ci) 的 laravel 应用程序。该项目的 composer.json 具有scripts
如下属性:
"scripts": {
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"@php artisan clear-compiled",
"@php artisan optimize",
"@php artisan migrate --force",
"@php artisan passport:install --force",
"@php artisan route:cache",
"@php artisan config:cache"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"heroku config:set APP_KEY=$(php artisan key:generate --show)"
]
}
一切正常,项目部署正常,但 APP_KEY 配置变量未在 heroku 上设置post-create-project-cmd
。(我已将heroku build pack toolbet添加到我的 heroku 应用程序中)
为什么它不能作为自动脚本工作,但如果在本地运行命令它就可以工作?