Skip to content

Commit

Permalink
fix(*): expose Bazel INSTALL_DESTDIR to Lua code and fix admin_gui in…
Browse files Browse the repository at this point in the history
… dev
  • Loading branch information
sumimakito committed Apr 18, 2024
1 parent 00d1c3f commit fcb3888
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ kong_directory_genrule(
fi
done
LN ${BUILD_DESTDIR}/openresty/nginx/sbin/nginx ${BUILD_DESTDIR}/openresty/bin/openresty
""",
""" + """
# Make INSTALL_DESTDIR available to Kong Lua code
echo 'return "%s/kong"' > ${BUILD_DESTDIR}/share/lua/5.1/kong/kong_usr_path.lua
""" % KONG_VAR["INSTALL_DESTDIR"],
# XXX: bazel forces 0555 as artifact permission, which is not correct for packagin
# here we deliberately use a different directory so file permission is preserved
# see also https://github.com/bazelbuild/bazel/issues/5588
Expand Down
6 changes: 5 additions & 1 deletion kong/cmd/utils/prefix_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,11 @@ local function prepare_prefix(kong_config, nginx_custom_template_path, skip_writ
end

if kong_config.admin_gui_listeners then
prepare_prefixed_interface_dir("/usr/local/kong", "gui", kong_config)
-- kong.kong_usr_path is an AUTO GENERATED Lua module generated by BUILD.bazel
-- It's only used for locating the GUI directory under Kong's USR path
-- The module itself DOES NOT exist under <PROJECT_ROOT>/kong
local kong_usr_path_ok, kong_usr_path = pcall(require, "kong.kong_usr_path")
prepare_prefixed_interface_dir(kong_usr_path_ok and kong_usr_path or "/usr/local/kong", "gui", kong_config)
end

if secrets then
Expand Down

0 comments on commit fcb3888

Please sign in to comment.