Skip to content

Commit

Permalink
Configurable julia path
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Salceanu committed Aug 5, 2024
1 parent 0d563bd commit 5032133
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GenieBuilder"
uuid = "c9453c14-af8a-11ec-351d-c7c9a2035d70"
authors = ["Adrian Salceanu"]
version = "0.17.4"
version = "0.17.5"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
14 changes: 10 additions & 4 deletions app/resources/applications/ApplicationsController.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ struct UnavailablePortException <: Exception
msg::String
end

juliabin() = get!(ENV, "GB_JULIA_PATH", "julia")

Base.showerror(io::IO, e::UnavailablePortException) = print(io, e.msg, " \nplease free Ports to create GenieBuilder App")

fullpath(app::Application) = abspath(app.path)
Expand Down Expand Up @@ -300,13 +302,14 @@ function boilerplate(app_path::String)
isdir(app_path) || mkpath(app_path)

try
cmd = Cmd(`julia --startup-file=no -e '
cmd = Cmd(`$(juliabin()) --startup-file=no -e '
using Pkg;
Pkg._auto_gc_enabled[] = false;
Pkg.activate(".");
Pkg.add("GenieFramework");
exit(0);
'`; dir = app_path)
cmd = addenv(cmd, "GB_JULIA_PATH" => juliabin())
cmd |> run
catch ex
@error ex
Expand Down Expand Up @@ -551,7 +554,7 @@ function start(app::Application)
create_lock_file(app) # set a lock file to know that the app is starting

try
cmd = Cmd(`julia --startup-file=no -e '
cmd = Cmd(`$(juliabin()) --startup-file=no -e '
using Pkg;
Pkg._auto_gc_enabled[] = false;
Pkg.activate(".");
Expand Down Expand Up @@ -620,6 +623,7 @@ function start(app::Application)
"GENIE_OPEN_BROWSER" => Base.get(ENV, "GENIE_OPEN_BROWSER", Base.get(ENV, "GB_HEADLESS", "false") == "true" ? "false" : "true"), # if it's headless, don't open browser.
"BASEPATH" => real_base_path(Base.get(ENV, "GB_APP_BASEPATH", ""), app.port),
"WSBASEPATH" => real_base_path(Base.get(ENV, "GB_APP_WSBASEPATH", ""), app.port),
"GB_JULIA_PATH" => juliabin(),
)

# in the cloud the :<port> becomes /<path>
Expand Down Expand Up @@ -1008,7 +1012,7 @@ function startpkgmng(app::Application)
try
@async notify("started:pkgmng", app.id) |> errormonitor

cmd = Cmd(`julia --startup-file=no -e '
cmd = Cmd(`$(juliabin()) --startup-file=no -e '
using Pkg;
Pkg._auto_gc_enabled[] = false;
Pkg.activate(".");
Expand All @@ -1021,7 +1025,9 @@ function startpkgmng(app::Application)
cmd = addenv(cmd, "PORT" => app.pkgmngport,
"HOST" => apphost,
"GENIE_ENV" => "dev",
"GENIE_BANNER" => "false")
"GENIE_BANNER" => "false",
"GB_JULIA_PATH" => juliabin(),
)
@async cmd |> run |> errormonitor
catch ex
@error ex
Expand Down
2 changes: 1 addition & 1 deletion src/Settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ end

function data()
haskey(SETTINGS[], "settings") || load_settings()
@show SETTINGS[]
# @show SETTINGS[]
return SETTINGS[]["settings"]
end

Expand Down

0 comments on commit 5032133

Please sign in to comment.