[Dashboard] Allow specifying `baseUrl` in config file
shutupflanders opened this issue · 3 comments
I've just deployed to a development environment with SSL enabled, as you can probably imagine I've hit an mixed content error.
Looking into the code of both the spa generation and your demo site, I can see that the ability to specify the baseUrl
is missing.
It looks like you've also hit this issue when deploying to your demo site as per the code below:
Can we have the ability to specify this baseUrl in the DashboardVariables
and by extension, the laravel-job-status
config file?
Temporary fix to anyone who comes across this issue:
Publish + modify routes.api.prefix
to the full hostname you'll be hosting at.
config/laravel-job-status.php
'routes' => [
'api' => [
// A prefix for all the API routes
'prefix' => "https://mysecuredomain.com/api", < - set this to the hostname that you'll be using
....
],
],
Run php artisan job:install
as per the documentation.
Manually register the routes (copied from php artisan route:list
after running php artisan job:install
)
routes/api.php
Route::get("/batches", [\JobStatus\Http\Controllers\Api\BatchController::class, 'index'])->name('api.job-status.batches.index');
Route::get("/batches/{job_status_batch}", [\JobStatus\Http\Controllers\Api\BatchController::class, 'show'])->name('api.job-status.batches.show');
Route::get("/jobs", [\JobStatus\Http\Controllers\Api\JobController::class, 'index'])->name('api.job-status.jobs.index');
Route::get("/jobs/{job_status_job_alias}", [\JobStatus\Http\Controllers\Api\JobController::class, 'show'])->name('api.job-status.jobs.show');
Route::get("/queues", [\JobStatus\Http\Controllers\Api\QueueController::class, 'index'])->name('api.job-status.queues.index');
Route::get("/queues/{job_status_queue}", [\JobStatus\Http\Controllers\Api\QueueController::class, 'show'])->name('api.job-status.queues.show');
Route::get("/runs", [\JobStatus\Http\Controllers\Api\RunController::class, 'index'])->name('api.job-status.runs.index');
Route::get("/runs/{job_status_run}", [\JobStatus\Http\Controllers\Api\RunController::class, 'show'])->name('api.job-status.runs.show');
Route::post("/runs/{job_status_run}/retry", [\JobStatus\Http\Controllers\Api\RunController::class, 'store'])->name('api.job-status.runs.retry');
Route::post("/runs/{job_status_run}/signal", [\JobStatus\Http\Controllers\Api\RunController::class, 'store'])->name('api.job-status.runs.signal');
The reason behind this fix is: when php artisan job:install
is run, it will add the routes with the hostname you specify in routes.api.prefix
, making them inaccessible.
Please let me know if I'm missing anything here, but I had a real struggle to get this working in a deployed setting.
@shutupflanders Hopefully that'll solve your issue - let me know and I'll get it released
Thanks again @shutupflanders - released in v1.2.1