@@ -76,8 +76,8 @@ install() {
7676 # Create install directory
7777 if [[ -d " $INSTALL_DIR " ]]; then
7878 warn " Directory '$INSTALL_DIR ' already exists."
79- if [[ -t 0 ]] || [[ -e /dev/tty ]]; then
80- read -rp " Overwrite configuration? [y/N]: " overwrite < /dev/tty 2> /dev/null || overwrite= " y "
79+ if [[ -t 0 ]] || { [[ -e /dev/tty ]] && echo -n ' ' > /dev/tty 2> /dev/null ; } ; then
80+ read -rp " Overwrite configuration? [y/N]: " overwrite < /dev/tty
8181 else
8282 overwrite=" y"
8383 info " No TTY available, proceeding with overwrite."
@@ -93,15 +93,19 @@ install() {
9393 curl -fsSL -o " $INSTALL_DIR /docker-compose.yml" " $REPO_BASE /docker-compose.yml"
9494 success " docker-compose.yml downloaded"
9595
96- # Create .env file
97- info " Generating configuration..."
98- {
99- echo " # AgentCrew configuration — generated by install.sh"
100- echo " NATS_AUTH_TOKEN=$NATS_TOKEN "
101- echo " # API_PORT=3000"
102- echo " # FRONTEND_PORT=8080"
103- } > " $INSTALL_DIR /.env"
104- success " .env created with secure NATS token"
96+ # Create .env file (preserve existing to keep NATS token)
97+ if [[ -f " $INSTALL_DIR /.env" ]]; then
98+ info " Existing .env found, keeping current configuration."
99+ else
100+ info " Generating configuration..."
101+ {
102+ echo " # AgentCrew configuration — generated by install.sh"
103+ echo " NATS_AUTH_TOKEN=$NATS_TOKEN "
104+ echo " # API_PORT=3000"
105+ echo " # FRONTEND_PORT=8080"
106+ } > " $INSTALL_DIR /.env"
107+ success " .env created with secure NATS token"
108+ fi
105109
106110 # Start the stack
107111 echo " "
0 commit comments