How do nested variables within the .env file work in CodeIgniter 4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How do nested variables within the .env file work in CodeIgniter 4 (/showthread.php?tid=76891) |
How do nested variables within the .env file work in CodeIgniter 4 - Dozor - 06-30-2020 Under the "Nesting Variables" section in the CI4 documentation under General Topics -> Configuration: "To save on typing, you can reuse variables that you’ve already specified in the file by wrapping the variable name within ${...}"
example in the documentation:
Code: BASE_DIR="/var/webroot/project-root" I was trying to use the following Code: app.baseURL = 'http://localhost:8080/' However, it's assigning it as a literal when print_r($_ENV) Code: [google.redirect] => ${app.baseURL}Google I've tried using non-namespaced keys including BASE_DIR (per the example) and it keeps printing as a literal. What's strange - When I use the following: Code: CI_ENVIRONMENT = development The result when print_r is: Code: [CI_ENVIRONMENT] => development My question is - What am I doing incorrectly and/or how should these be set/used correctly? According to the documentation, It makes it seem like I should be able to use any key within the .env file that was already assigned using
${somekeyinthisenvfile}CI version: 4.0.3 PHP 7.4.0 Using CI CLI RE: How do nested variables within the .env file work in CodeIgniter 4 - Dozor - 06-30-2020 To add onto this: I've tried the following Code: CI_ENVIRONMENT = development Which produces the following in print_r($_ENV): Code: [CI_ENVIRONMENT] => development RE: How do nested variables within the .env file work in CodeIgniter 4 - Dozor - 06-30-2020 Looks like the DotEnv.php file from composer was outdated. answer from StackOverflow: https://stackoverflow.com/questions/62648655/how-do-nested-variables-within-the-env-file-work-in-codeigniter-4 |