From 6c9ea8a6c898e286fe35c67a1aec439d737a3774 Mon Sep 17 00:00:00 2001 From: Samuel Durante Date: Tue, 18 Mar 2025 20:47:32 +0000 Subject: [PATCH] Allow creating AI API .env file via `start-dev.sh` script --- start-dev.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/start-dev.sh b/start-dev.sh index ade1708a..cc02ea9a 100755 --- a/start-dev.sh +++ b/start-dev.sh @@ -1,6 +1,17 @@ #!/bin/bash set -e +AI_API_USERNAME=$(openssl rand -hex 12) +AI_API_PASSWORD=$(openssl rand -hex 12) + +# if there is no .env file in AI API, create one +if [ ! -f ./ai/.env ]; then + echo "OPENAI_DEFAULT_MODEL_NAME=gpt-3.5-turbo" >> ./ai/.env + echo "OPENAI_API_KEY=" >> ./ai/.env + echo "BASIC_AUTH_USERNAME=$AI_API_USERNAME" >> ./ai/.env + echo "BASIC_AUTH_PASSWORD=$AI_API_PASSWORD" >> ./ai/.env +fi + # if there is no .env file in API, create one if [ ! -f ./apps/api/.env ]; then echo "NODE_ENV=development" > ./apps/api/.env @@ -11,8 +22,8 @@ if [ ! -f ./apps/api/.env ]; then echo "LOGIN_JWT_SECRET=$(openssl rand -hex 24)" >> ./apps/api/.env echo "AUTH_JWT_SECRET=$(openssl rand -hex 24)" >> ./apps/api/.env echo "AI_API_URL='http://localhost:8000'" >> ./apps/api/.env - echo "AI_API_USERNAME=$(openssl rand -hex 12)" >> ./apps/api/.env - echo "AI_API_PASSWORD=$(openssl rand -hex 12)" >> ./apps/api/.env + echo "AI_API_USERNAME=$AI_API_USERNAME" >> ./apps/api/.env + echo "AI_API_PASSWORD=$AI_API_PASSWORD" >> ./apps/api/.env echo "PYTHON_ALLOWED_LIBRARIES='plotly,matplotlib,numpy,pandas'" >> ./apps/api/.env echo "POSTGRES_USERNAME=postgres" >> ./apps/api/.env echo "POSTGRES_PASSWORD=password" >> ./apps/api/.env