Skip to content

Commit c856388

Browse files
committed
fix(test,doc): port env name change
Older JuliaHub jobimage environments used `PORT` as the environment variable name. This was updated to `JULIAHUB_APP_PORT` in newer (v2) jobimage environment. This updates the tests to check both. Also updates the example in the docs.
1 parent 18706d7 commit c856388

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/src/guides/jobs.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ import JuliaHub # hide
253253
job = JuliaHub.submit_job(
254254
JuliaHub.script"""
255255
using Oxygen, HTTP
256-
PORT = parse(Int, ENV["PORT"])
256+
# Environment variable name `PORT` was used in older JuliaHub environments
257+
# and has been replaced with `JULIAHUB_APP_PORT` in newer environments
258+
PORT = parse(Int, get(ENV, "JULIAHUB_APP_PORT", ENV["PORT"]))
257259
@get "/" function(req::HTTP.Request)
258260
return "success"
259261
end

test/jobenvs/job-exposed-port/server.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using Oxygen, HTTP
22

3-
const PORT = parse(Int, ENV["PORT"])
3+
# Environment variable name `PORT` was used in older JuliaHub environments
4+
# and has been replaced with `JULIAHUB_APP_PORT` in newer environments
5+
const PORT = parse(Int, get(ENV, "JULIAHUB_APP_PORT", ENV["PORT"]))
46
const NREQUESTS = Ref{Int}(0)
57

68
function results_json()

0 commit comments

Comments
 (0)