telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 6c8ebe69917d004d6b9ef2fab817fbdf87176fd7
parent 1d04d32fbe0620817b814cc9518902881b4bdb0d
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon,  5 Feb 2018 12:48:50 +0100

Drop dependency on the Lua iconv module, GeoIP2/GeoLite2 databases are encoded as UTF-8

Diffstat:
MREADME.md | 6++----
Mtelize | 17-----------------
2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md @@ -41,17 +41,15 @@ against LuaJIT: ### Lua modules -Telize requires the following Lua modules: +Telize requires the following Lua module: - Lua CJSON -- Lua iconv Installing via LuaRocks: luarocks install lua-cjson - luarocks install lua-iconv -Alternatively, those modules can be installed directly using binary packages. +Alternatively, this module can be installed directly using binary packages. ### GeoIP databases diff --git a/telize b/telize @@ -88,8 +88,6 @@ server { content_by_lua_block { local cjson = require("cjson") - local iconv = require("iconv") - local cd = iconv.new("utf-8","iso-8859-15") ngx.header["Cache-Control"] = "no-cache"; @@ -137,21 +135,6 @@ server { payload.longitude = tonumber(payload.longitude) end - -- Convert city name to UTF-8 if it exists - if payload.city ~= nil then - payload.city = cd:iconv(payload.city) - end - - -- Convert region name to UTF-8 if it exists - if payload.region ~= nil then - payload.region = cd:iconv(payload.region) - end - - -- Convert organization name to UTF-8 if it exists - if payload.organization ~= nil then - payload.organization = cd:iconv(payload.organization) - end - local json = cjson.encode(payload) if callback ~= "" then