Connehito / cake-sentry

CakePHP plugin integration for Sentry
MIT License
34 stars 26 forks source link

CakePHP 3.6.x Sentry Environments #22

Open magic-77 opened 4 years ago

magic-77 commented 4 years ago

Hi, how to define Environments for

can't find any Docs how to do it for a CakePHP App

EDIT: in "app/config/app.php" i have setup these settings for each instance

'Sentry' => [
        'dsn' => '__DSN__',
        'environment' => 'production' // can be 'local' or 'staging'
    ],
o0h commented 4 years ago

How about using dotenv ? It is refered in cookbook. The .env file is generally listed in .gitignore, so you have to create the file in each stage. Once you set .env and define ENVIRONMENT, you can read it from CakeApp by using env('ENVIRONMENT').

In addition, Sentry SDK will load which stage the app is running from $SERVER['SENTRY_ENVIRONMENT']. So you can also use this way. see: https://docs.sentry.io/error-reporting/configuration/?platform=php#environment

davalb commented 4 years ago

If you configure Sentry in your app/config/app.php file, you need to use the options key. Like this:

'Sentry' => [
    'dsn' => '__DSN__',
    'options' => [
        'environment' => 'production',
    ],
],