Skip to content

Cleanup .env{,.custom} handling #1539

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 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Please visit [our documentation](https://develop.sentry.dev/self-hosted/) for ev

### Customize DotEnv (.env) file

Environment specific configurations can be done in the `.env.custom` file. It will be located in the root directory of the Sentry installation.
Environment specific configurations can be done in the `.env.custom` file. It will be located in the root directory of the Sentry installation, and if it exists then `.env` will be ignored entirely.

By default, there exists no `.env.custom` file. In this case, you can manually add this file by copying the `.env` file to a new `.env.custom` file and adjust your settings in the `.env.custom` file.

Please keep in mind to check the `.env` file for changes, when you perform an upgrade of Sentry, so that you can adjust your `.env.custom` accordingly, if required.
Please keep in mind to check the `.env` file for changes, when you perform an upgrade of Sentry, so that you can adjust your `.env.custom` accordingly, if required, as `.env` is ignored entirely if `.env.custom` is present.

### Enhance Sentry image

Expand Down
10 changes: 6 additions & 4 deletions install/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ else
cd "$(dirname $0)" # assume we're a test script or some such
fi

# Allow `.env` overrides using the `.env.custom` file
if [[ -f "../.env.custom" ]]; then
_ENV="$(realpath ../.env.custom)"
# Allow `.env` overrides using the `.env.custom` file.
# We pass this to docker compose in a couple places.
basedir="$( cd .. ; pwd -P )" # realpath is missing on stock macOS
if [[ -f "$basedir/.env.custom" ]]; then
_ENV="$basedir/.env.custom"
else
_ENV="$(realpath ../.env)"
_ENV="$basedir/.env"
fi

# Read .env for default values with a tip o' the hat to https://stackoverflow.com/a/59831605/90297
Expand Down