Welcome Guest, Not a member yet? Register   Sign In
Debug toolbar on production
#1

Is there any possibility to enable debug toolbar on production for some user privillege or in specific controller ?
in CI3 it was quite easy to enable it by  for example in this way

if($user[['role]=='admin') $this->output->enable_profiler(true)

is something similar possible in CI4 ?
Reply
#2

(This post was last modified: 12-24-2021, 03:26 AM by captain-sensible. Edit Reason: spelling mistakes )

good question so that general users can't see output , but admin you can ?

The way I enable or disable debug is via index.php at public like so :

Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';
// or
$_SERVER['CI_ENVIRONMENT'] = 'production';

generally I do all my testing on local , so that basically to all intents and purposes live is a clone of whats on local. However I have done some live editing of code , (big mistake ) which went pear shape. I fixed it by editing live the index.php to have the line quoted above as "development" . It gave me output from live, with the clue how to fix it.

index.php and .env pretty global so i can't think how you would do that.
CMS CI4     I use Arch Linux by the way 

Reply
#3

(12-23-2021, 01:47 AM)Vodecki Wrote: Is there any possibility to enable debug toolbar on production for some user privillege or in specific controller ?
in CI3 it was quite easy to enable it by  for example in this way

if($user[['role]=='admin') $this->output->enable_profiler(true)

is something similar possible in CI4 ?

No. CI4 uses the constant to enable debug toolbar.
As you know constants cannot change on the runtime.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB