Getting the full URL from within a job?

Dear all,
I have been trying to get the full url of my omeka-s install while performing a Job in a class that extends AbstractJob. The way I am trying to do it is the following :

$serverUrl = $this->getServiceLocator()->get('ViewHelperManager')->get('serverUrl');
$this->logger->info("[AbstractJob] : ServerUrl: ".$serverUrl());

When running the job, I get the following in my logs :
[AbstractJob] : ServerUrl: http:// {"userId":1,"jobId":1494}

If I try to run the same script from a function in Module.php which extends AbstractModule I get the following result:
[AbstractModule] : ServerUrl: http://127.0.0.1 {"userId":1}

What would be the best way to be able from my job to have a serverUrl that contains the full URL to my site?

Best regards,
Sylvain

We automatically pass along the base URL to jobs so that making relative links works correctly, but we don’t do the same for the “server URL.” Your best option is going to be to read the server URL at job creation time and just pass it along as an argument to your job.

Thanks @jflatnes for confirming this and giving an alternative option.

S.