How do nested variables within the .env file work in CodeIgniter 4 |
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
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
Looks like the DotEnv.php file from composer was outdated.
answer from StackOverflow: https://stackoverflow.com/questions/6264...eigniter-4 |
Welcome Guest, Not a member yet? Register Sign In |