directus bootstrap

This commit is contained in:
Valentin 2024-02-23 22:32:51 +01:00
parent fbd0479e08
commit 7f0449f7e1
1 changed files with 36 additions and 3 deletions

View File

@ -215,9 +215,42 @@ read answer
if [[ "$answer" == "y" ]]; then if [[ "$answer" == "y" ]]; then
install_pkg tmux install_pkg tmux
get_username get_username
if [[ -z "$db_directus_password" ]]; then
echo -e "${PURPLE}${BOLD}Enter the MariaDB Directus password : ${RESET}"
read -s db_directus_password
echo
fi
echo -e "${PURPLE}${BOLD}Generate and store the credentials somewhere safe${RESET}"
echo -e "${PURPLE}${BOLD}Enter the Directus admin email : ${RESET}"
read -s directus_admin_email
echo -e "${PURPLE}${BOLD}Enter the Directus admin password : ${RESET}"
read -s directus_admin_password
cms_folder="cms.${domain_name}"
env_file="${cms_folder}/.env"
key=$(head -c 16 /dev/urandom | od -An -tx1 | tr -d ' \n')
secret=$(head -c 16 /dev/urandom | od -An -tx1 | tr -d ' \n')
su -c "cd &&\ su -c "cd &&\
npm init -y directus-project@latest cms &&\ mkdir ${$cms_folder} &&\
echo \"HOST=${ip}\" >> cms/.env &&\ mkdir ${$cms_folder}/uploads &&\
echo \"PUBLIC_URL=cms.${domain_name}\" >> cms/.env" $username echo \"HOST=\\"${ip}\\"\" >> ${env_file} &&\
echo \"PUBLIC_URL=\\"cms.${domain_name}\\"\" >> ${env_file} &&\
echo \"PORT=8055\" >> ${env_file} &&\
echo \"DB_CLIENT=\\"mysql\\"\" >> ${env_file} &&\
echo \"DB_HOST=\\"127.0.0.1\\"\" >> ${env_file} &&\
echo \"DB_PORT=\\"3306\\"\" >> ${env_file} &&\
echo \"DB_DATABASE=\\"directus\\"\" >> ${env_file} &&\
echo \"DB_USER=\\"directus\\"\" >> ${env_file} &&\
echo \"DB_PASSWORD=\\"${db_directus_password}\\"\" >> ${env_file} &&\
echo \"SECRET=\\"${secret}\\"\" >> ${env_file} &&\
echo \"KEY=\\"${key}\\"\" >> ${env_file} &&\
echo \"ADMIN_EMAIL=\\"${directus_admin_email}\\"\" >> ${env_file} &&\
echo \"ADMIN_PASSWORD=\\"${directus_admin_password}\\"\" >> ${env_file} &&\
npx directus bootstrap" $username
fi fi
# TODO REMOVE EXPECT IF IT IS INSTALLED # TODO REMOVE EXPECT IF IT IS INSTALLED