69 řádky
1.5 KiB
Bash
69 řádky
1.5 KiB
Bash
|
set -e
|
||
|
|
||
|
echo "# Výběr portu"
|
||
|
read -p "Port serveru [7000]: " port
|
||
|
|
||
|
echo "# Konfigurace databáze"
|
||
|
read -p "Host databáze [localhost]: " db_host
|
||
|
read -p "Port databáze [5432]: " db_port
|
||
|
|
||
|
read -p "Uživatelské jméno: " db_user
|
||
|
if [ -z ${db_user} ]
|
||
|
then
|
||
|
echo "Uživatelské jméno je povinné"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
read -p "Heslo: " db_password
|
||
|
if [ -z ${db_password} ]
|
||
|
then
|
||
|
echo "Heslo je povinné"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
read -p "Jméno databáze: " db_name
|
||
|
if [ -z ${db_name} ]
|
||
|
then
|
||
|
echo "Jméno databáze je povinné"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "# Konfigurace redisu"
|
||
|
read -p "Host redisu [localhost]: " redis_host
|
||
|
read -p "Číslo databáze [0]: " redis_db
|
||
|
|
||
|
echo "# Konfigurace stránky"
|
||
|
|
||
|
read -p "Jméno stránky: " site_name
|
||
|
if [ -z ${site_name} ]
|
||
|
then
|
||
|
echo "Jméno stránky je povinné"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
read -p "Popis stránky: " site_description
|
||
|
if [ -z ${site_description} ]
|
||
|
then
|
||
|
echo "Popis stránky je povinný"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
export PORT=${port:-7000}
|
||
|
export DB_HOST=${db_host:-localhost}
|
||
|
export DB_PORT=${db_host:-5432}
|
||
|
export DB_USER=${db_user}
|
||
|
export DB_PASSWORD=${db_password}
|
||
|
export DB_NAME=${db_name}
|
||
|
export REDIS_HOST=${redis_host:-localhost}
|
||
|
export REDIS_DB=${redis_db:-0}
|
||
|
export REDIS_HOST=${redis_host:-localhost}
|
||
|
export SITE_NAME=${site_name}
|
||
|
export SITE_DESCRIPTION=${site_description}
|
||
|
|
||
|
export AUTH_SECRET=`tr -dc A-Za-z0-9 </dev/urandom | head -c 16`
|
||
|
export TRIP_SECRET=`tr -dc A-Za-z0-9 </dev/urandom | head -c 16`
|
||
|
export UID_SECRET=`tr -dc A-Za-z0-9 </dev/urandom | head -c 16`
|
||
|
|
||
|
envsubst < Nekrochan.toml.template > Nekrochan.toml
|
||
|
mkdir -p ./uploads/thumb
|