Skip to content

Commit

Permalink
feat: enable environment detection by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Neunerlei committed Dec 13, 2022
1 parent 4613619 commit 83d4cde
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Classes/Dbg.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Dbg
protected static $config
= [
'enabled' => true,
'environmentDetection' => false,
'environmentDetection' => true,
'envVarKey' => 'PROJECT_ENV',
'envVarValue' => 'dev',
'cliIsDev' => true,
Expand Down Expand Up @@ -129,15 +129,15 @@ public static function init(): void
}
}
}

/**
* Used to configure the debugging context.
*
* Possible values:
*
* - enabled: (bool) default: TRUE | Master switch to enable/disable the debugging functionality. If you set this to
* false, none of the functions will do or output anything.
* - environmentDetection: (bool) default: FALSE | Enables the environment detection mechanism if set to true.
* - environmentDetection: (bool) default: TRUE | Disables the environment detection mechanism if set to false.
* - envVarKey: (string) default: PROJECT_ENV | Determines the name of the environment variable to look for when
* enabling the debug feature.
* - envVarValue: (string) default: dev | Used in combination with "envVarKey" and determines which value to expect
Expand Down Expand Up @@ -212,7 +212,7 @@ public static function isEnabled(): bool
}

// NO Environment detection? -> Yes
if (($conf['environmentDetection'] ?? false) === false) {
if (($conf['environmentDetection'] ?? true) === false) {
return true;
}

Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@ with a dynamic IP address). If you want to use this, you have to code that featu

It is possible to define multiple options for the debugger. The configuration is performed using the dbgConfig() function. Possible config options are:

- enabled: (bool) default: TRUE | Master switch to enable/disable the debugging functionality. If you set this to false, none of the functions will do or output
- enabled: (bool) default: TRUE | Master switch to enable/disable the debugging functionality. If you set this to false,
none of the functions will do or output
anything.
- environmentDetection: (bool) default: FALSE | Enables the environment detection mechanism if set to true.
- envVarKey: (string) default: PROJECT_ENV | Determines the name of the environment variable to look for when enabling the debug feature.
- envVarValue: (string) default: dev | Used in combination with "envVarKey" and determines which value to expect from the configured environment variable to
- environmentDetection: (bool) default: TRUE | Disables the environment detection mechanism if set to false.
- envVarKey: (string) default: PROJECT_ENV | Determines the name of the environment variable to look for when
enabling the debug feature.
- envVarValue: (string) default: dev | Used in combination with "envVarKey" and determines which value to expect
from the configured environment variable to
enable the debugger.
- cliIsDev: (bool) default: TRUE | Determines if the debugger should always output stuff in a CLI environment or not.
- debugReferrer: (string|NULL) default: NULL | If set this will be expected as the referrer to enable the debugger capabilities.
- preHooks: (callable|array) | One or multiple callbacks to run in front of each debugger function (dbg,dbge,trace,tracee,...). Useful for extending the
- cliIsDev: (bool) default: TRUE | Determines if the debugger should always output stuff in a CLI environment or
not.
- debugReferrer: (string|NULL) default: NULL | If set this will be expected as the referrer to enable the debugger
capabilities.
- preHooks: (callable|array) | One or multiple callbacks to run in front of each debugger function (
dbg,dbge,trace,tracee,...). Useful for extending the
functionality. Each callback will receive $hookType, $callingFunction and $givenArguments as arguments.
- postHooks: (callable|array) | Same as "preHooks" but run after the debug output.
- consolePassword: (string|NULL) default: NULL | If set the phpConsole will require this value as password before printing the console output to the browser.
Expand Down

0 comments on commit 83d4cde

Please sign in to comment.