mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1681 from YunoHost/enh_app_shell
apps: Enhance app_shell()
This commit is contained in:
commit
bcd2550fdd
2 changed files with 5 additions and 2 deletions
|
@ -124,7 +124,7 @@ ynh_remove_apps() {
|
||||||
# Requires YunoHost version 11.0.* or higher, and that the app relies on packaging v2 or higher.
|
# Requires YunoHost version 11.0.* or higher, and that the app relies on packaging v2 or higher.
|
||||||
# The spawned shell will have environment variables loaded and environment files sourced
|
# The spawned shell will have environment variables loaded and environment files sourced
|
||||||
# from the app's service configuration file (defaults to $app.service, overridable by the packager with `service` setting).
|
# from the app's service configuration file (defaults to $app.service, overridable by the packager with `service` setting).
|
||||||
# If the app relies on a specific PHP version, then `php` will be aliased that version.
|
# If the app relies on a specific PHP version, then `php` will be aliased that version. The PHP command will also be appended with the `phpflags` settings.
|
||||||
ynh_spawn_app_shell() {
|
ynh_spawn_app_shell() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=a
|
local legacy_args=a
|
||||||
|
@ -176,9 +176,10 @@ ynh_spawn_app_shell() {
|
||||||
# Force `php` to its intended version
|
# Force `php` to its intended version
|
||||||
# We use `eval`+`export` since `alias` is not propagated to subshells, even with `export`
|
# We use `eval`+`export` since `alias` is not propagated to subshells, even with `export`
|
||||||
local phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
local phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
local phpflags=$(ynh_app_setting_get --app=$app --key=phpflags)
|
||||||
if [ -n "$phpversion" ]
|
if [ -n "$phpversion" ]
|
||||||
then
|
then
|
||||||
eval "php() { php${phpversion} \"\$@\"; }"
|
eval "php() { php${phpversion} ${phpflags} \"\$@\"; }"
|
||||||
export -f php
|
export -f php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -957,6 +957,8 @@ app:
|
||||||
### app_shell()
|
### app_shell()
|
||||||
shell:
|
shell:
|
||||||
action_help: Open an interactive shell with the app environment already loaded
|
action_help: Open an interactive shell with the app environment already loaded
|
||||||
|
# Here we set a GET only not to lock the command line. There is no actual API endpoint for app_shell()
|
||||||
|
api: GET /apps/<app>/shell
|
||||||
arguments:
|
arguments:
|
||||||
app:
|
app:
|
||||||
help: App ID
|
help: App ID
|
||||||
|
|
Loading…
Add table
Reference in a new issue