Skip to content

Commit

Permalink
More startup information and "Nginx Plus" version matching
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Apr 11, 2015
1 parent 251d063 commit cda4e68
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/cli/utils/signal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local IO = require "kong.tools.io"
local cutils = require "kong.cli.utils"
local constants = require "kong.constants"
local inspect = require "inspect"

-- Cache config path, parsed config and DAO factory
local kong_config_path
Expand Down Expand Up @@ -40,7 +41,7 @@ local function is_openresty(path_to_check)
if code ~= 0 then
cutils.logger:error_exit(out)
end
return out:match("^nginx version: ngx_openresty/") or out:match("^nginx version: openresty/")
return out:match("^nginx version: ngx_openresty/") or out:match("^nginx version: openresty/" or out:match("^nginx version: nginx/[%w.%s]+%(nginx%-plus.+%)")
end
return false
end
Expand Down Expand Up @@ -98,10 +99,22 @@ local function prepare_nginx_working_dir(args_config)
end
end

-- Prettifies table properties in a nice human readable way
-- @return The prettified string
local function prettify_table_properties(t)
local result = ""
for k,v in pairs(t) do
result = result..k.."="..v.." "
end
return result == "" and result or result:sub(1, string.len(result) - 1)
end

-- Prepare the database keyspace if needed (run schema migrations)
-- @param args_config Path to the desired configuration (usually from the --config CLI argument)
local function prepare_database(args_config)
local _, _, dao_factory = get_kong_config_path(args_config)
local _, kong_config, dao_factory = get_kong_config_path(args_config)

cutils.logger:log("Database: "..kong_config.database..", "..prettify_table_properties(kong_config.databases_available[kong_config.database].properties))

-- Migrate the DB if needed and possible
local keyspace, err = dao_factory:get_migrations()
Expand Down

2 comments on commit cda4e68

@thibaultcha
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Kong can run on nginx plus?

@subnetmarco
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thibaultcha yes if the Nginx Plus Lua module has been compiled with LuaJIT (which doesn't seem to be the case). Will follow up with the nginx team to see if there is a way to enable LuaJIT.

Please sign in to comment.