Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CakePHP 3.6.x Sentry Environments #22

Open
magic-77 opened this issue Nov 25, 2019 · 2 comments
Open

CakePHP 3.6.x Sentry Environments #22

magic-77 opened this issue Nov 25, 2019 · 2 comments
Labels
question Further information is requested

Comments

@magic-77
Copy link

magic-77 commented Nov 25, 2019

Hi,
how to define Environments for

  • local
  • staging
  • production

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'
    ],
@magic-77 magic-77 changed the title Sentry Environments CakePHP 3.6.x Sentry Environments Nov 25, 2019
@o0h
Copy link
Contributor

o0h commented Nov 25, 2019

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

@o0h o0h added the question Further information is requested label Nov 25, 2019
@davalb
Copy link

davalb commented Sep 22, 2020

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',
    ],
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants