mardi 14 janvier 2020

Executing config:cache command during deployment

I have a secret test key for a payment gateway in the .env file.

APP_TIMEZONE = 'Africa/Lagos'
APP_PAYSTACK_KEY = sk_test_b6c0b4925403blablabla

Reason is that other people working on the project can use their own test key if they have. So in a payment controller i get the value of this key like so:

"authorization: Bearer " .env('APP_PAYSTACK_KEY' , 'sk_test_b6c0b4925403blablabla')

During deployment I intend runing config:cache so that laravel won't be going a long trip in getting the required configuration setups. But from laravel documentation :

If you execute the config:cache command during your deployment process, you should be sure that you are only calling the env function from within your configuration files. Once the configuration has been cached, the .env file will not be loaded and all calls to the env function will return null.

so my question is "how can I set this APP_PAYSTACK_KEY in the config file and how to retrieve it anywhere in my app?".



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2soqBz0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire