myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit 7a5ca1b4bb0353d0410e62ffc640eb81963f1b29
parent 586f9e2185ac99277323f58a698969826a946971
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sun, 20 Oct 2024 12:26:41 +0200

doc: env for developmnet setup

Diffstat:
D.env | 50--------------------------------------------------
Adev/env | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Adev/init-db.sh | 13+++++++++++++
Mdocs/DEVELOPMENT_SETUP.md | 3+++
4 files changed, 66 insertions(+), 50 deletions(-)

diff --git a/.env b/.env @@ -1,49 +0,0 @@ -########## -# Shared # -########## - -# Full URI to backend http API -VITE_API_URI=http://127.0.0.1 -# Backend API http port -VITE_API_PORT=8000 - -############ -# Frontend # -############ - -# Application window title -VITE_APP_DOC_TITLE='My Heats' -# Cookie TTL in seconds (session ttl in the admin/judges frontend), 60m -VITE_SESSION_TTL=3600 -# Full URI to backend websocket API -VITE_WS_URI=ws://127.0.0.1 -# Backend API websocket port -VITE_WS_PORT=8000 -# Locale for frontend date formatting -VITE_LOCALE=en-US - -########### -# Backend # -########### - -# Redirect url for magic links -API_REDIRECT_URI=http://localhost:5173/authverify -# Backend API CORS allowed origins -API_CORS_ALLOW_ORIGIN=http://localhost:5173 -# JWT secret for magic links (`openssl rand -base64 48`) -API_JWT_SECRET= -# JWT TTL in seconds, make it biger than VITE_SESSION_TTL, 60m -API_JWT_TTL=3600 - -# SMTP settings for sending magic links -SMTP_HOST= -# upgrade later with STARTTLS -SMTP_STARTTLS= -SMTP_PORT= -SMTP_USER= -SMTP_FROM= -SMTP_PASSWORD= - -# PostgreSQL environment variables for psql client -# https://github.com/porsager/postgres?tab=readme-ov-file#environmental-variables -# PGHOST, PGPORT, PGDATABASE, PGUSERNAME, PGPASSWORD, etc. -\ No newline at end of file diff --git a/dev/env b/dev/env @@ -0,0 +1,49 @@ +########## +# Shared # +########## + +# Full URI to backend http API +VITE_API_URI=http://127.0.0.1 +# Backend API http port +VITE_API_PORT=8000 + +############ +# Frontend # +############ + +# Application window title +VITE_APP_DOC_TITLE='MyHeats' +# Cookie TTL in seconds (session ttl in the admin/judges frontend), 60m +VITE_SESSION_TTL=3600 #1h +# Full URI to backend websocket API +VITE_WS_URI=ws://127.0.0.1 +# Backend API websocket port +VITE_WS_PORT=8000 +# Locale for frontend date formatting +VITE_LOCALE=en-US + +########### +# Backend # +########### + +# Redirect url for magic links +API_REDIRECT_URI=http://127.0.0.1:5173/authverify +# Backend API CORS allowed origins +API_CORS_ALLOW_ORIGIN=http://127.0.0.1:5173 +# JWT secret for magic links (`openssl rand -base64 48`) +API_JWT_SECRET= +# JWT TTL in seconds, make it biger than VITE_SESSION_TTL, 60m +API_JWT_TTL=3600 + +# SMTP settings for sending magic links +SMTP_HOST= +# upgrade later with STARTTLS +SMTP_STARTTLS= +SMTP_PORT= +SMTP_USER= +SMTP_FROM= +SMTP_PASSWORD= + +# PostgreSQL environment variables for psql client +# https://github.com/porsager/postgres?tab=readme-ov-file#environmental-variables +# PGHOST, PGPORT, PGDATABASE, PGUSERNAME, PGPASSWORD, etc. +\ No newline at end of file diff --git a/dev/init-db.sh b/dev/init-db.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# set -o errexit +# set -o nounset +set -o xtrace + +# enable logical replication for publications +sed -i 's/#wal_level = replica/wal_level = logical/' /var/lib/postgresql/data/postgresql.conf +pg_ctl restart + +# import database schema +cat /schema/*.sql | psql -h /var/run/postgresql -U $PGUSERNAME +\ No newline at end of file diff --git a/docs/DEVELOPMENT_SETUP.md b/docs/DEVELOPMENT_SETUP.md @@ -1,5 +1,8 @@ # Development setup +Define the environment variables for frontend/backend according to the example +in `./dev/env`. + ## Nix development environment You can create a nix-shell for development purposes: ```