Skip to content

Commit 9240b3f

Browse files
author
Sebastian Krätzig
committed
Add support for custom DotEnv file
1 parent 5b7ab52 commit 9240b3f

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ target/
6969
# https://docs.docker.com/compose/extends/
7070
docker-compose.override.yml
7171

72+
# https://docs.docker.com/compose/environment-variables/#using-the---env-file--option
73+
.env.custom
74+
7275
*.tar
7376
data/
7477
.vscode/tags

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ Official bootstrap for running your own [Sentry](https://sentry.io/) with [Docke
1212

1313
## Setup
1414

15+
### Customize DotEnv (.env) file
16+
17+
Environment specific configurations can be done in the `.env.custom` file. It will be located in the root directory of the Sentry installation.
18+
19+
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.
20+
21+
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.
22+
23+
### Installation
24+
1525
To get started with all the defaults, simply clone the repo and run `./install.sh` in your local check-out. Sentry uses Python 3 by default since December 4th, 2020 and Sentry 21.1.0 is the last version to support Python 2.
1626

1727
During the install, a prompt will ask if you want to create a user account. If you require that the install not be blocked by the prompt, run `./install.sh --no-user-prompt`.

install/_lib.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ else
1212
cd "$(dirname $0)" # assume we're a test script or some such
1313
fi
1414

15-
_ENV="$(realpath ../.env)"
15+
# Allow `.env` overrides using the `.env.custom` file
16+
if [[ -f "../.env.custom" ]]; then
17+
_ENV="$(realpath ../.env.custom)"
18+
else
19+
_ENV="$(realpath ../.env)"
20+
fi
1621

1722
# Read .env for default values with a tip o' the hat to https://stackoverflow.com/a/59831605/90297
1823
t=$(mktemp) && export -p > "$t" && set -a && . $_ENV && set +a && . "$t" && rm "$t" && unset t
@@ -26,7 +31,7 @@ else
2631
fi
2732

2833
dc_base="$(docker compose version &> /dev/null && echo 'docker compose' || echo 'docker-compose')"
29-
dc="$dc_base --ansi never"
34+
dc="$dc_base --ansi never --env-file ${_ENV}"
3035
dcr="$dc run --rm"
3136

3237
# A couple of the config files are referenced from other subscripts, so they

install/wrap-up.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ else
1919
echo ""
2020
echo "You're all done! Run the following command to get Sentry running:"
2121
echo ""
22+
if [[ "${_ENV}" =~ ".env.custom" ]]; then
23+
echo " $dc_base --env-file ${_ENV} up -d"
24+
else
2225
echo " $dc_base up -d"
26+
fi
2327
echo ""
2428
echo "-----------------------------------------------------------------"
2529
echo ""

0 commit comments

Comments
 (0)