Skip to content

feat: make system.secret-key configurable from environment variables #3783

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

Merged
merged 10 commits into from
Jul 2, 2025

Conversation

aldy505
Copy link
Collaborator

@aldy505 aldy505 commented Jun 29, 2025

Closes #1226

Generate SENTRY_SYSTEM_SECRET_KEY with a secret value on .env.custom.
This also introduces the usage of .env.custom across self-hosted deployment. Might break some people's automation though, but hopefully it won/t if they don't change their sentry/sentry.conf.py file.

Closes #1226

Generate `SENTRY_SYSTEM_SECRET_KEY` with a secret value on `.env.custom`.
This also introduces the usage of `.env.custom` across self-hosted deployment. Might break some people's automation though, but hopefully it won/t if they don't change their `sentry/sentry.conf.py` file.
Copy link

codecov bot commented Jun 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.45%. Comparing base (b5a0158) to head (1c39735).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3783   +/-   ##
=======================================
  Coverage   99.45%   99.45%           
=======================================
  Files           3        3           
  Lines         183      183           
=======================================
  Hits          182      182           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be creating an .env.custom file automatically. It really complicates things.

Can we instead write the value into the config file (.py one) if the env variable is not set? If it is set, we just use that one and replace the !!changeme!! part with nothing forcing an execption to be thrown when the key is missing?

@aldy505 aldy505 requested a review from BYK July 2, 2025 01:35
@aldy505
Copy link
Collaborator Author

aldy505 commented Jul 2, 2025

I made it much more simpler now.

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

# Sentry event retention days specifies how long events are retained in the database.
# This should be set on your `.env` or `.env.custom` file, instead of modifying
# the value here.
# NOTE: The longer the days, the more disk space is required.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# NOTE: The longer the days, the more disk space is required.
# NOTE: The longer the days, the more disk space is required and 90 days is the maximum value you can use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and 90 days is the maximum value you can use.

Actually, no. You can go for 365 days. See getsentry/sentry#94602

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was told many places in the system assume a maximum of 90 days that's why I suggested this. And the issue you linked kind of shows that? :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But still :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻‍♂️

@aldy505 aldy505 merged commit d3a068d into master Jul 2, 2025
13 checks passed
@aldy505 aldy505 deleted the aldy505/feat/secret-key-configurable-env branch July 2, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Make system.secret-key configurable via environment
3 participants