How to set sqlite db path through ROOTPATH variable in .env file |
If I want to set path to sqlite db in app/config/Database.php file like this:
PHP Code: 'database' => ROOTPATH . 'writable/db.sqlite3', PHP Code: database.default.database = '/home/me/dev/project/writable/db.sqlite3'
==
Donatas G.
Since the .env file is a text file, you cannot use your constants there. You need to write the values themselves (in this case the value of ROOTPATH)
(09-08-2021, 12:25 AM)paulbalandan Wrote: Since the .env file is a text file, you cannot use your constants there. You need to write the values themselves (in this case the value of ROOTPATH) Agh thank you, that makes sense... and is so unfortunate. Can I perhaps use relative path? No, just checked, neither Code: database.default.database = 'writable/db.sqlite3' nor Code: database.default.database = './writable/db.sqlite3' work...
==
Donatas G.
You can use relative paths but they are a bit tricky because they are relative to the calling script, which is public/index.php- see https://github.com/codeigniter4projects/...nv.example for example:
../writable/database.db
It would be great to have specific folders for each environment, config, as it was on v3.x..
(09-13-2021, 03:50 AM)FlavioSuar Wrote: It would be great to have specific folders for each environment, config, as it was on v3.x.. There are some per-environment files at app/Config/Boot where you can customized things. These are called pretty early in the boot cycle but I don't recall exactly how early, so the features already loaded may be hit or miss.
|
Welcome Guest, Not a member yet? Register Sign In |