1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/acropolis_ynh.git synced 2024-09-03 18:06:22 +02:00

Merge pull request #39 from tms-phillips/create_admin

Create admin
This commit is contained in:
David Sterry 2021-12-29 12:07:13 -08:00 committed by GitHub
commit 62d5ad01ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -30,6 +30,18 @@
"name": "domain",
"type": "domain"
},
{
"name": "username",
"type": "user"
},
{
"name": "email",
"type": "email"
},
{
"name": "password",
"type": "password"
},
{
"name": "is_public",
"type": "boolean",

View file

@ -28,6 +28,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
username=$YNH_APP_ARG_USERNAME
email=$YNH_APP_ARG_EMAIL
password=$YNH_APP_ARG_PASSWORD
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
@ -247,13 +250,15 @@ pushd "$final_path"
sudo -u $app $ynh_ruby_load_path bin/bundle install --full-index
popd
ynh_script_progression --message="Preparing the database..."
ynh_script_progression --message="Preparing the database and create initial admin user..."
pushd "$final_path"
rake_exec="sudo -u $app $ynh_ruby_load_path RAILS_ENV=production bin/rake"
ynh_exec_warn_less $rake_exec db:migrate
ynh_exec_warn_less $rake_exec assets:precompile
ynh_exec_warn_less $rake_exec "admin:create[$username, $email, $password]"
popd
#=================================================
# SETUP THE CRON FILE
#=================================================