Skip to content

Commit 1c4c8d2

Browse files
authored
Update hh-token-refresh.sh
1 parent afe0761 commit 1c4c8d2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/hh-token-refresh.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
3+
IFS=$'\n\t'
34

4-
ENV_FILE="/opt/job-search/telegram-bot/.env"
5+
ENV_FILE="${ENV_FILE:-/opt/job-search/telegram-bot/.env}"
6+
[[ -f "$ENV_FILE" ]] || { logger -t hh-token-refresh "env file not found: $ENV_FILE"; exit 3; }
57
STATE_DIR="/var/lib/hh-token"
68
CUR="${STATE_DIR}/token.json"
79
NEW="${STATE_DIR}/token.json.new"
@@ -12,7 +14,8 @@ mkdir -p "$STATE_DIR"
1214
chmod 700 "$STATE_DIR"
1315

1416
set -a
15-
source "$ENV_FILE"
17+
# shellcheck source=/dev/null
18+
. "$ENV_FILE"
1619
set +a
1720

1821
if [[ ! -f "$CUR" ]]; then

0 commit comments

Comments
 (0)