在安装Heroku Composer之后自动设置APP_KEY环境变量

时间:2019-09-01 11:56:16

标签: github heroku heroku-cli composer.json post-install

我已经在heroku上设置了一个可连续部署(larvis 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)"
        ]
    }

一切正常,项目正常部署,但是post-create-project-cmd不在heroku上设置APP_KEY config var。 (我在我的heroku应用中添加了 heroku build pack toolbet

为什么它不能作为自动化脚本运行,但是如果在本地运行命令,它就可以运行吗?

0 个答案:

没有答案