From 3571747718ea47e7a2d522adc8d5b2c03c64d261 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 6 May 2017 16:53:54 +0200 Subject: [PATCH] Nouveau helper ynh_webpath_available et ynh_webpath_register (#235) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Nouveau helper ynh_path_validity Simplement un wrapper de yunohost app checkurl. Peut-être une occasion de lui donner un autre nom plus parlant. Il me semble justement qu'il en était question. Conflicts: data/helpers.d/network * Renaming ynh_path_validity to ynh_webpath_available * Splitting domain and path * Use the new url-available command instead of deprecated checkurl * Adding ynh_webpath_register * [enh] Check before register - Need to be tested. - And... probably lack a echo to inform in case of error. * Fixing helper following discussion with Maniack --- data/helpers.d/network | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/data/helpers.d/network b/data/helpers.d/network index 750a49cf6..c6764c1f5 100644 --- a/data/helpers.d/network +++ b/data/helpers.d/network @@ -36,4 +36,32 @@ ynh_find_port () { port=$((port+1)) # Else, pass to next port done echo $port -} \ No newline at end of file +} + +# Check availability of a web path +# +# example: ynh_webpath_available some.domain.tld /coffee +# +# usage: ynh_webpath_available domain path +# | arg: domain - the domain/host of the url +# | arg: path - the web path to check the availability of +ynh_webpath_available () { + local domain=$1 + local path=$2 + sudo yunohost domain url-available $domain $path +} + +# Register/book a web path for an app +# +# example: ynh_webpath_register wordpress some.domain.tld /coffee +# +# usage: ynh_webpath_register app domain path +# | arg: app - the app for which the domain should be registered +# | arg: domain - the domain/host of the web path +# | arg: path - the web path to be registered +ynh_webpath_register () { + local app=$1 + local domain=$2 + local path=$3 + sudo yunohost app register-url $app $domain $path +}