Skip to content

Commit 424c596

Browse files
author
Gabriel Baker
committed
Address PR review comments
- Remove inline comments from wrapper script heredoc - Fix env verification to parse lines instead of unsafe shell-loading - Add standard access URL format to completion block
1 parent 5c51259 commit 424c596

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

ct/nebula-sync.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ description
5050

5151
msg_ok "Completed successfully!\n"
5252
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
53-
echo -e "${INFO}${YW} Nebula-Sync runs as a service and will sync your Pi-hole instances.${CL}"
53+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
54+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
5455
echo -e "${INFO}${YW} Configuration:${CL}"
5556
echo -e "${TAB}${GATEWAY}${BGN}/opt/nebula-sync/.env${CL}"
5657
echo -e "${INFO}${YW} View logs:${CL}"

install/nebula-sync-install.sh

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ BINARY="/opt/nebula-sync/nebula-sync"
194194
# Load environment variables from .env file
195195
if [[ -f "$ENV_FILE" ]]; then
196196
while IFS= read -r line || [[ -n "$line" ]]; do
197-
# Skip empty lines and comments
198197
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
199-
# Only process lines that look like KEY=VALUE
200198
if [[ "$line" =~ ^[A-Z_][A-Z0-9_]*= ]]; then
201199
key="${line%%=*}"
202200
value="${line#*=}"
@@ -205,7 +203,6 @@ if [[ -f "$ENV_FILE" ]]; then
205203
done < "$ENV_FILE"
206204
fi
207205
208-
# Execute nebula-sync
209206
exec "$BINARY" run
210207
EOFWRAPPER
211208
chmod +x "${INSTALL_PATH}/nebula-sync-wrapper.sh"
@@ -233,18 +230,12 @@ EOF
233230
234231
msg_info "Verifying service configuration"
235232
if [[ -f "$ENV_PATH" ]]; then
236-
set +u
237-
set -a
238-
source "$ENV_PATH" 2>/dev/null || true
239-
set +a
240-
if [[ -z "${PRIMARY:-}" ]] || [[ -z "${REPLICAS:-}" ]]; then
241-
msg_warn "Environment variables not loading correctly from $ENV_PATH"
242-
msg_info "File contents:"
243-
head -5 "$ENV_PATH"
244-
else
233+
if grep -q "^PRIMARY=" "$ENV_PATH" && grep -q "^REPLICAS=" "$ENV_PATH"; then
245234
msg_ok "Environment variables verified"
235+
else
236+
msg_error "Required environment variables (PRIMARY, REPLICAS) not found in $ENV_PATH"
237+
exit 1
246238
fi
247-
set -u
248239
else
249240
msg_error ".env file not found at $ENV_PATH"
250241
exit 1

0 commit comments

Comments
 (0)