Last active
March 27, 2017 10:59
-
-
Save ostark/372d438a58abd0e50569be60fe5725ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Deploy sensitive files (laravel/passport example) | |
* | |
* OAUTH_PRIVATE_KEY (content of oauth-private.key) and OAUTH_PUB_KEY (content of oauth-public.key) must be stored in App Secrets | |
* https://help.fortrabbit.com/secrets | |
* | |
* Call this script post deployment (fortrabbit.yml) | |
* https://help.fortrabbit.com/deployment-file-v2#toc-a-minimal-example | |
*/ | |
// Read secrets json >> array | |
$secrets = json_decode(file_get_contents(getenv('APP_SECRETS')), true); | |
// Target path | |
$path = '/srv/app/' . getenv('APP_NAME') . '/htdocs/storage'; | |
// Key contents | |
$privateKey = $secrets['CUSTOM']['OAUTH_PRIVATE_KEY']; | |
$pubKey = $secrets['CUSTOM']['OAUTH_PUB_KEY']; | |
// Write private key | |
file_put_contents("$path/oauth-private.key", $privateKey); | |
// Write pub key | |
file_put_contents("$path/oauth-public.key", $pubKey); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment