Skip to content

Commit

Permalink
Merge pull request #86 from GearsAD/master
Browse files Browse the repository at this point in the history
Potential fix for #85
  • Loading branch information
essenciary authored Dec 16, 2018
2 parents 2bbc5d1 + ad4b2fa commit 1403080
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ function execute(config::Settings) :: Nothing

Genie.config.app_env = ENV["GENIE_ENV"]
Genie.config.server_port = parse(Int, parsed_args["server:port"])
if haskey(parsed_args, "server:host") && parsed_args["server:host"] != nothing
Genie.config.server_host = parsed_args["server:host"]
end

if called_command(parsed_args, "s") || called_command(parsed_args, "server:start")
Genie.config.run_as_server = true
AppServer.startup(Genie.config.server_port)
AppServer.startup(Genie.config.server_port, Genie.config.server_host)
end

nothing
Expand Down Expand Up @@ -47,6 +50,9 @@ function parse_commandline_args() :: Dict{String,Any}
"--server:port", "-p"
help = "HTTP server port"
default = "8000"
"--server:host", "-l"
help = "Host IP to listen on"
# default = "" #This is by default open (0.0.0.0), set to 127.0.0.1 for only localhost
end

parse_args(settings)
Expand Down
5 changes: 4 additions & 1 deletion src/Configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ App configuration - sets up the app's defaults. Individual options are overwritt
"""
mutable struct Settings
server_port::Int
server_host::String
server_workers_count::Int
server_document_root::String
server_handle_static_files::Bool
Expand Down Expand Up @@ -131,6 +132,7 @@ mutable struct Settings

Settings(;
server_port = 8000, # default port for binding the web server
server_host = "0.0.0.0",
server_workers_count = 1,
server_document_root = "public",
server_handle_static_files = true,
Expand Down Expand Up @@ -196,7 +198,8 @@ mutable struct Settings
renderer_default_layout_file = :app,
) =
new(
server_port, server_workers_count, server_document_root, server_handle_static_files, server_signature,
server_port, server_host,
server_workers_count, server_document_root, server_handle_static_files, server_signature,
app_env,
cors_headers, cors_allowed_origins,
suppress_output, output_length,
Expand Down

0 comments on commit 1403080

Please sign in to comment.