Skip to content

Commit

Permalink
[bin] detect and forward LUA_CPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Jan 3, 2018
1 parent c497a10 commit d890768
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 9 additions & 3 deletions gateway/bin/apicast
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down

0 comments on commit d890768

Please sign in to comment.