I try to use helhum/dotenv-connector in my TYPO3 Project.
I have done the following:
my composer.json
:
{
"require": {
"typo3/cms": "^8.5",
"helhum/dotenv-connector": "1.0.0",
"helhum/typo3-console": "^4.1"
},
"extra": {
"helhum/typo3-console": {
"install-extension-dummy": false
},
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
},
"helhum/dotenv-connector": {
"env-dir": "",
"allow-overrides": true,
"cache-dir": "var/cache"
}
}
}
Then I ran
composer install
After that I setup the TYPO3 using the command
php vendor/bin/typo3cms install:setup
This should be similar with doing the install the "normal" way.
After that, i placed a .env
next to my composer.json
This .env
contains the following:
TYPO3_CONTEXT="Development"
TYPO3__DB__database="dotenvconnector"
TYPO3__DB__host="127.0.0.1"
TYPO3__DB__password="root"
TYPO3__DB__port="3306"
TYPO3__DB__username="root"
Then i removed all informations about the DB from web/typo3conf/LocalConfiguration.php
using the typo3_console-command
php vendor/bin/typo3cms configuration:remove DB
I then ran composer install
and composer update
again.
When calling the TYPO3 in the browser now, it keeps telling me
The requested database connection named "Default" has not been configured.
So what am i missing? Obviously my .env
is not parsed or used at all.
FYI: Cachefile is written in var/cache with the following content:
<?php
putenv('TYPO3__DB__database=dotenvconnector');
$_ENV['TYPO3__DB__database'] = 'dotenvconnector';
$_SERVER['TYPO3__DB__database'] = 'dotenvconnector';
putenv('TYPO3__DB__host=localhost');
$_ENV['TYPO3__DB__host'] = 'localhost';
$_SERVER['TYPO3__DB__host'] = 'localhost';
putenv('TYPO3__DB__password=root');
$_ENV['TYPO3__DB__password'] = 'root';
$_SERVER['TYPO3__DB__password'] = 'root';
putenv('TYPO3__DB__port=3306');
$_ENV['TYPO3__DB__port'] = '3306';
$_SERVER['TYPO3__DB__port'] = '3306';
putenv('TYPO3__DB__username=root');
$_ENV['TYPO3__DB__username'] = 'root';
$_SERVER['TYPO3__DB__username'] = 'root';