chore: improve setup script environment initialization

This commit is contained in:
ramvignesh-b
2026-05-04 22:06:29 +05:30
parent bea9b13249
commit c6dc82591d
2 changed files with 25 additions and 14 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ DB_NAME=piku_test_db
DB_USER=test DB_USER=test
DB_PASSWORD=password123 DB_PASSWORD=password123
DB_HOST=127.0.0.1 DB_HOST=127.0.0.1
DB_PORT=5433 DB_PORT=5443
# SSL # SSL
SSL_ENABLED=true SSL_ENABLED=true
@@ -12,7 +12,7 @@ SSL_ENABLED=true
DEBUG=True DEBUG=True
SECRET_KEY=django-insecure-initial-key SECRET_KEY=django-insecure-initial-key
BACKEND_DOMAIN=127.0.0.1 BACKEND_DOMAIN=127.0.0.1
BACKEND_PORT=8001 BACKEND_PORT=8101
# EMAIL # EMAIL
EMAIL_HOST=127.0.0.1 EMAIL_HOST=127.0.0.1
@@ -25,4 +25,4 @@ EMAIL_API_PORT=8026
# FRONTEND # FRONTEND
FRONTEND_PORT=5199 FRONTEND_PORT=5199
FRONTEND_DOMAIN=127.0.0.1 FRONTEND_DOMAIN=127.0.0.1
VITE_API_URL=https://127.0.0.1:8001 VITE_API_URL=https://127.0.0.1:8101
+11
View File
@@ -1,6 +1,14 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Setup Env from examples
if [ ! -f ".env" ]; then
cp .env.example .env
fi
if [ ! -f ".env.e2e" ]; then
cp .env.e2e.example .env.e2e
fi
NODE_BIN=$(command -v bun || command -v npm || true) NODE_BIN=$(command -v bun || command -v npm || true)
PY_BIN=$(command -v uv || command -v pip || true) PY_BIN=$(command -v uv || command -v pip || true)
DISTRO_BIN=$(command -v apt || command -v yum || command -v pacman || command -v zypper || true) DISTRO_BIN=$(command -v apt || command -v yum || command -v pacman || command -v zypper || true)
@@ -35,6 +43,8 @@ else
fi fi
# Simplify ssl generation for local - source & credits:- https://github.com/FiloSottile/mkcert # Simplify ssl generation for local - source & credits:- https://github.com/FiloSottile/mkcert
# Note, still try to perform the setup if pkg setups fail
{
echo "[Cert] Setting up SSL..." echo "[Cert] Setting up SSL..."
# pre-requisites (might be available already, just in case) # pre-requisites (might be available already, just in case)
if [ $(basename "$DISTRO_BIN") = "apt" ]; then if [ $(basename "$DISTRO_BIN") = "apt" ]; then
@@ -46,6 +56,7 @@ elif [ $(basename "$DISTRO_BIN") = "pacman" ]; then
elif [ $(basename "$DISTRO_BIN") = "zypper" ]; then elif [ $(basename "$DISTRO_BIN") = "zypper" ]; then
sudo zypper install -y mozilla-nss-tools sudo zypper install -y mozilla-nss-tools
fi fi
} || true
# Detect os and arch to get the appropriate bin. Windows: ...NO SOUP FOR YOU! # Detect os and arch to get the appropriate bin. Windows: ...NO SOUP FOR YOU!
OS=$(uname -s) OS=$(uname -s)