File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change
1
+ ENV_LOCAL_PATH=/app/.env.local
2
+
1
3
if test -z " ${DOTENV_LOCAL} " ; then
2
- if ! test -f " /app/.env.local " ; then
4
+ if ! test -f " ${ENV_LOCAL_PATH} " ; then
3
5
echo " DOTENV_LOCAL was not found in the ENV variables and .env.local is not set using a bind volume. We are using the default .env config."
4
6
fi ;
5
7
else
6
8
echo " DOTENV_LOCAL was found in the ENV variables. Creating .env.local file."
7
- cat <<< " $DOTENV_LOCAL" > /app/.env.local
9
+ cat <<< " $DOTENV_LOCAL" > ${ENV_LOCAL_PATH}
8
10
fi ;
9
11
10
12
if [ " $INCLUDE_DB " = " true" ] ; then
11
- echo " INCLUDE_DB is set to true. Appending MONGODB_URL "
13
+ echo " INCLUDE_DB is set to true."
12
14
13
- touch /app/.env.local
14
- echo -e " \nMONGODB_URL=mongodb://localhost:27017" >> /app/.env.local
15
+ MONGODB_CONFIG=" MONGODB_URL=mongodb://localhost:27017"
16
+ if ! grep -q " ^${MONGODB_CONFIG} $" ${ENV_LOCAL_PATH} ; then
17
+ echo " Appending MONGODB_URL"
18
+ touch /app/.env.local
19
+ echo -e " \n${MONGODB_CONFIG} " >> ${ENV_LOCAL_PATH}
20
+ fi
15
21
16
22
mkdir -p /data/db
17
23
mongod &
You can’t perform that action at this time.
0 commit comments