Bird
0
0

During a multi-environment deployment, you want to ensure each environment has a unique app key without committing keys to version control. What is the best practice?

hard📝 Application Q9 of 15
Laravel - Configuration and Environment
During a multi-environment deployment, you want to ensure each environment has a unique app key without committing keys to version control. What is the best practice?
ACommit the .env file with the key to the repository
BSet the APP_KEY directly in config/app.php
CRun <code>php artisan key:generate</code> on each environment manually
DUse the same key for all environments for consistency
Step-by-Step Solution
Solution:
  1. Step 1: Understand environment-specific keys

    Each environment should have a unique key to secure its data independently.
  2. Step 2: Avoid committing sensitive keys

    Keys should not be committed to version control; generating keys per environment is best.
  3. Final Answer:

    Run php artisan key:generate on each environment manually -> Option C
  4. Quick Check:

    Unique keys per environment via manual generation [OK]
Quick Trick: Generate keys per environment, never commit .env keys [OK]
Common Mistakes:
  • Committing .env with keys
  • Using same key everywhere
  • Setting key in config/app.php

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes