Skip to content

Commit d3a068d

Browse files
authored
feat: make system.secret-key configurable from environment variables (#3783)
1 parent b5a0158 commit d3a068d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

sentry/config.example.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ system.internal-url-prefix: 'http://web:9000'
5252
# If this file ever becomes compromised, it's important to generate a new key.
5353
# Changing this value will result in all current sessions being invalidated.
5454
# A new key can be generated with `$ sentry config generate-secret-key`
55+
#
56+
# If you are using SENTRY_SYSTEM_SECRET_KEY that is being set on your `.env` or `.env.custom` file,
57+
# you should remove this line below as it won't be used anyway.
5558
system.secret-key: '!!changeme!!'
5659

5760
# The ``redis.clusters`` setting is used, unsurprisingly, to configure Redis

sentry/sentry.conf.example.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,25 @@ def get_internal_network():
6464
# and thus various UI optimizations should be enabled.
6565
SENTRY_SINGLE_ORGANIZATION = True
6666

67+
# Sentry event retention days specifies how long events are retained in the database.
68+
# This should be set on your `.env` or `.env.custom` file, instead of modifying
69+
# the value here.
70+
# NOTE: The longer the days, the more disk space is required.
6771
SENTRY_OPTIONS["system.event-retention-days"] = int(
6872
env("SENTRY_EVENT_RETENTION_DAYS", "90")
6973
)
7074

75+
# The secret key is being used for various cryptographic operations, such as
76+
# generating a CSRF token, session token, and registering Relay instances.
77+
# The secret key value should be set on your `.env` or `.env.custom` file
78+
# instead of modifying the value here.
79+
#
80+
# If the key ever becomes compromised, it's important to generate a new key.
81+
# Changing this value will result in all current sessions being invalidated.
82+
# A new key can be generated with `$ sentry config generate-secret-key`
83+
if env("SENTRY_SYSTEM_SECRET_KEY"):
84+
SENTRY_OPTIONS["system.secret-key"] = env("SENTRY_SYSTEM_SECRET_KEY", "")
85+
7186
# Self-hosted Sentry infamously has a lot of Docker containers required to make
7287
# all the features work. Oftentimes, users don't use the full feature set that
7388
# requires all the containers. This is a way to enable only the error monitoring

0 commit comments

Comments
 (0)