mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
Create root key for api during post-installation
This commit is contained in:
parent
3de168d103
commit
98d664c45d
1 changed files with 9 additions and 0 deletions
|
@ -131,4 +131,13 @@ sed -i "s@YNH_FORUM_TITLE@$title@g" ../sources/configuration.yml
|
||||||
sudo cp ../sources/configuration.yml $final_path
|
sudo cp ../sources/configuration.yml $final_path
|
||||||
sudo su - www-data -s /bin/bash -c "cd $final_path && php -d memory_limit=-1 flarum install -f configuration.yml"
|
sudo su - www-data -s /bin/bash -c "cd $final_path && php -d memory_limit=-1 flarum install -f configuration.yml"
|
||||||
sudo rm $final_path/configuration.yml
|
sudo rm $final_path/configuration.yml
|
||||||
|
|
||||||
|
# Generate and add root token for user creation and deletion
|
||||||
|
roottoken=$(ynh_string_random 40)
|
||||||
|
apitablesql="CREATE TABLE IF NOT EXISTS api_keys (api_key TEXT(40) NOT NULL UNIQUE)"
|
||||||
|
rootsql="INSERT INTO api_keys VALUES ('"$roottoken"')"
|
||||||
|
ynh_mysql_execute_as_root "$apitablesql" $dbname
|
||||||
|
ynh_mysql_execute_as_root "$rootsql" $dbname
|
||||||
|
ynh_app_setting_set "$app" root_token "$roottoken"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue