Skip to content

Commit e135a57

Browse files
joshzarrabiForest Eckhardt
authored and
Forest Eckhardt
committed
sets LUA_PATH to load the resty.core module
see openresty/lua-nginx-module#1533 Signed-off-by: Forest Eckhardt <[email protected]>
1 parent 4fbce6b commit e135a57

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/nginx/supply/supply.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ func (s *Supplier) Run() error {
115115

116116
func (s *Supplier) WriteProfileD() error {
117117
if s.Config.Dist == "openresty" {
118-
err := s.Stager.WriteProfileD("openresty", fmt.Sprintf("export LD_LIBRARY_PATH=$DEPS_DIR/%s/nginx/luajit/lib\n", s.Stager.DepsIdx()))
118+
err := s.Stager.WriteProfileD(
119+
"openresty",
120+
fmt.Sprintf(
121+
"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH%s$DEPS_DIR/%s/nginx/luajit/lib\nexport LUA_PATH=$DEPS_DIR/%s/nginx/lualib/?.lua\n",
122+
string(os.PathListSeparator),
123+
s.Stager.DepsIdx(),
124+
s.Stager.DepsIdx(),
125+
))
119126
if err != nil {
120127
return err
121128
}

src/nginx/supply/supply_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package supply_test
22

33
import (
44
"bytes"
5+
"fmt"
56
"io/ioutil"
67
"os"
78
"path/filepath"
@@ -185,8 +186,12 @@ var _ = Describe("Supply", func() {
185186
})
186187

187188
It("writes openresty script", func() {
188-
mockStager.EXPECT().DepsIdx().Return("0").Times(2)
189-
mockStager.EXPECT().WriteProfileD("openresty", "export LD_LIBRARY_PATH=$DEPS_DIR/0/nginx/luajit/lib\n")
189+
mockStager.EXPECT().DepsIdx().Return("0").Times(3)
190+
mockStager.EXPECT().WriteProfileD("openresty", fmt.Sprintf(
191+
"%s%s",
192+
"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPS_DIR/0/nginx/luajit/lib\n",
193+
"export LUA_PATH=$DEPS_DIR/0/nginx/lualib/?.lua\n",
194+
))
190195
mockStager.EXPECT().WriteProfileD("nginx", "export DEP_DIR=$DEPS_DIR/0\nmkdir -p logs")
191196

192197
supplier.Config.Dist = "openresty"

0 commit comments

Comments
 (0)