Skip to content

Commit a02c499

Browse files
committed
When running install.sh check if user already authenticated
1 parent 4288e8e commit a02c499

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

install.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,25 @@ post_install() {
122122
echo "" >&2
123123

124124
# --- Authentication ---
125-
log "Authenticate to start running queries and accessing your Dune account."
126-
printf " Authenticate with Dune now? [Y/n] " >&2
127-
read -r answer < /dev/tty || answer=""
128-
case "$answer" in
129-
[nN]*)
130-
log "Skipped. You can authenticate later with: dune auth"
131-
;;
132-
*)
133-
echo "" >&2
134-
log "You'll need a Dune API key."
135-
log "Go to https://dune.com and navigate to APIs and Connectors > API Keys."
136-
echo "" >&2
137-
"$dune_bin" auth < /dev/tty || log "Authentication failed. You can retry with: dune auth"
138-
;;
139-
esac
125+
if "$dune_bin" usage > /dev/null 2>&1; then
126+
log "Already authenticated with Dune."
127+
else
128+
log "Authenticate to start running queries and accessing your Dune account."
129+
printf " Authenticate with Dune now? [Y/n] " >&2
130+
read -r answer < /dev/tty || answer=""
131+
case "$answer" in
132+
[nN]*)
133+
log "Skipped. You can authenticate later with: dune auth"
134+
;;
135+
*)
136+
echo "" >&2
137+
log "You'll need a Dune API key."
138+
log "Go to https://dune.com and navigate to APIs and Connectors > API Keys."
139+
echo "" >&2
140+
"$dune_bin" auth < /dev/tty || log "Authentication failed. You can retry with: dune auth"
141+
;;
142+
esac
143+
fi
140144

141145
echo "" >&2
142146
log "Dune CLI ${dune_version} installed successfully!"

0 commit comments

Comments
 (0)