Create a helper to read in a optional local_url to bypass the need to access the application using the external url.

This commit is contained in:
Patrick Winnertz
2024-08-23 08:43:11 +02:00
parent 91944570db
commit 8463eda5ba
2 changed files with 23 additions and 1 deletions

View File

@@ -88,6 +88,28 @@ if ( ! function_exists('base_url'))
}
}
if ( ! function_exists('local_url'))
{
/**
* Local URL
*
* For cornercases where you have no access to the base_url from
* within e.g. the docker container to the base_url use this url
* for cron jobs.
*
* If local_url is not defined return base_url instead.
*
* @param string $uri
* @param string $protocol
* @return string
*/
function local_url($uri = '', $protocol = NULL)
{
return get_instance()->config->local_url($uri, $protocol) ?? get_instance()->config->base_url($uri, $protocol);
}
}
// ------------------------------------------------------------------------
if ( ! function_exists('current_url'))