Skip to content

Commit 07c9dc4

Browse files
MahrWeMickLeskMohamedBassem
authored
Update Hoarder: Improvement .env location (see PR comment for little migration) (#1325)
* Update .env file location in hoarder-install.sh * Update .env file location in hoarder.sh No more need to move around the .env file * migration of .env to hoarder.env in hoarder.sh * Update ct/hoarder.sh Co-authored-by: Mohamed Bassem <[email protected]> --------- Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Mohamed Bassem <[email protected]>
1 parent 8caf5e5 commit 07c9dc4

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ct/hoarder.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ function update_script() {
4040
msg_ok "Stopped Services"
4141
msg_info "Updating ${APP} to v${RELEASE}"
4242
cd /opt
43-
mv /opt/hoarder/.env /opt/.env
43+
if [[ -f /opt/hoarder/.env ]] && [[ ! -f /etc/hoarder/hoarder.env ]]; then
44+
mkdir -p /etc/hoarder
45+
mv /opt/hoarder/.env /etc/hoarder/hoarder.env
46+
fi
4447
rm -rf /opt/hoarder
4548
wget -q "https://github.com/hoarder-app/hoarder/archive/refs/tags/v${RELEASE}.zip"
4649
unzip -q v${RELEASE}.zip
@@ -54,8 +57,7 @@ function update_script() {
5457
export DATA_DIR=/opt/hoarder_data
5558
cd /opt/hoarder/packages/db
5659
pnpm migrate &>/dev/null
57-
mv /opt/.env /opt/hoarder/.env
58-
sed -i "s/SERVER_VERSION=${PREV_RELEASE}/SERVER_VERSION=${RELEASE}/" /opt/hoarder/.env
60+
sed -i "s/SERVER_VERSION=${PREV_RELEASE}/SERVER_VERSION=${RELEASE}/" /etc/hoarder/hoarder.env
5961
msg_ok "Updated ${APP} to v${RELEASE}"
6062

6163
msg_info "Starting Services"
@@ -79,4 +81,4 @@ description
7981
msg_ok "Completed Successfully!\n"
8082
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
8183
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
82-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
84+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/hoarder-install.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ $STD pnpm install --frozen-lockfile
7878

7979
export DATA_DIR=/opt/hoarder_data
8080
HOARDER_SECRET=$(openssl rand -base64 36 | cut -c1-24)
81-
cat <<EOF >/opt/hoarder/.env
81+
mkdir -p /etc/hoarder
82+
cat <<EOF >/etc/hoarder/hoarder.env
8283
SERVER_VERSION=$RELEASE
8384
NEXTAUTH_SECRET="$HOARDER_SECRET"
8485
NEXTAUTH_URL="http://localhost:3000"
@@ -129,7 +130,7 @@ After=network.target hoarder-workers.service
129130
[Service]
130131
ExecStart=pnpm start
131132
WorkingDirectory=/opt/hoarder/apps/web
132-
EnvironmentFile=/opt/hoarder/.env
133+
EnvironmentFile=/etc/hoarder/hoarder.env
133134
Restart=always
134135
135136
[Install]
@@ -159,7 +160,7 @@ After=network.target hoarder-browser.service meilisearch.service
159160
[Service]
160161
ExecStart=pnpm start:prod
161162
WorkingDirectory=/opt/hoarder/apps/workers
162-
EnvironmentFile=/opt/hoarder/.env
163+
EnvironmentFile=/etc/hoarder/hoarder.env
163164
Restart=always
164165
TimeoutStopSec=5
165166

0 commit comments

Comments
 (0)