4 # Set the database variable to the default first.
5 # Don't forget to change this string to your actual database parameters
6 # if you don't plan to initialize the database in this script.
7 export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
9 # Set other environment variables
10 export JWT_SECRET=changeme
13 yes_no_prompt_invalid() {
14 echo "Invalid input. Please enter either \"y\" or \"n\"." 1>&2
20 while [ "$init_db_valid" == 0 ]
22 read -p "Initialize database (y/n)? " init_db
24 [yY]* ) init_db_valid=1; init_db_final=1;;
25 [nN]* ) init_db_valid=1; init_db_final=0;;
26 * ) yes_no_prompt_invalid;;
30 if [ "$init_db_final" = 1 ]
32 source ./server/db-init.sh
33 read -n 1 -s -r -p "Press ANY KEY to continue execution of this script, press CTRL+C to quit..."
38 ask_to_auto_reload() {
41 while [ "$auto_reload_valid" == 0 ]
43 echo "Automagically reload the project when source files are changed?"
44 echo "ONLY ENABLE THIS FOR DEVELOPMENT!"
45 read -p "(y/n) " auto_reload
46 case "$auto_reload" in
47 [yY]* ) auto_reload_valid=1; auto_reload_final=1;;
48 [nN]* ) auto_reload_valid=1; auto_reload_final=0;;
49 * ) yes_no_prompt_invalid;;
53 if [ "$auto_reload_final" = 1 ]
56 cd server && cargo watch -x run
60 # Optionally initialize the database
63 # Build the web client
68 # Build and run the backend
70 RUST_LOG=debug cargo run
72 # For live coding, where both the front and back end, automagically reload on any save