diff --git a/CHANGELOG.md b/CHANGELOG.md index 70f420e43..de65dc4cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Detecting local rover installation from the CLI [PR #519](https://github.com/3scale/apicast/pull/519) - Use more `command` instead of `which` to work in plain shell [PR #521](https://github.com/3scale/apicast/pull/521) -- Fixed rockspec so APIcast can be installed by luarocks [PR #523](https://github.com/3scale/apicast/pull/523) +- Fixed rockspec so APIcast can be installed by luarocks [PR #523](https://github.com/3scale/apicast/pull/523), [PR #538](https://github.com/3scale/apicast/pull/538) - Fix loading renamed APIcast code [PR #525](https://github.com/3scale/apicast/pull/525) - Fix `apicast` command when installed from luarocks [PR #527](https://github.com/3scale/apicast/pull/527) - Fix lua docs formatting in the CORS policy [PR #530](https://github.com/3scale/apicast/pull/530) diff --git a/gateway/bin/apicast b/gateway/bin/apicast index 87a5e7c36..80cd0d20a 100755 --- a/gateway/bin/apicast +++ b/gateway/bin/apicast @@ -36,20 +36,23 @@ _LUA_ return ( $rock . '/bin', $rock . '/conf', - $rock =~ s{/lib/luarocks/rocks/apicast/.+?/?$}[/share/lua/@{[ detect_lua_version ]}]r + $rock =~ s{/lib/luarocks/rocks/apicast/.+?/?$}[/share/lua/@{[ detect_lua_version ]}]r, + $rock =~ s{/lib/luarocks/rocks/apicast/.+?/?$}[/lib/lua/@{[ detect_lua_version ]}]r, ); } else { return ( $apicast_dir . '/bin', $apicast_dir, - $apicast_dir . '/src' + $apicast_dir . '/src', + $apicast_dir . '/lib', ) } } -my ($apicast_bin, $apicast_conf, $apicast_src) = detect_apicast_paths(); +my ($apicast_bin, $apicast_conf, $apicast_src, $apicast_lib) = detect_apicast_paths(); my $lua_path = $ENV{LUA_PATH}; +my $lua_lib = $ENV{LUA_CPATH}; my $cwd = getcwd(); $ENV{PATH} .= ":$cwd/lua_modules/bin"; @@ -61,11 +64,14 @@ if ($rover && !$lua_path) { exec '/usr/bin/env', $rover, 'exec', $0, @ARGV } else { $lua_path ||= ';'; + $lua_lib ||= ';'; } $ENV{APICAST_DIR} = $apicast_conf; $ENV{LUA_PATH} = sprintf('%1$s/?.lua;', $apicast_src) . $lua_path; +$ENV{LUA_CPATH} = sprintf('%1$s/?.so;', $apicast_lib) . $lua_lib; + $ENV{PWD} = $cwd; my $bin = "$apicast_bin/cli";