Skip to content

Commit bc75783

Browse files
committed
fix(cmd) kong migrations should accept the -p or --prefix option
to override the default prefix
1 parent 6b4ef30 commit bc75783

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

kong/cmd/migrations.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Options:
4545
4646
-c,--conf (optional string) Configuration file.
4747
48+
-p,--prefix (optional string) Override prefix directory.
49+
4850
]]
4951

5052

@@ -80,7 +82,9 @@ local function execute(args)
8082
log.disable()
8183
end
8284

83-
local conf = assert(conf_loader(args.conf))
85+
local conf = assert(conf_loader(args.conf, {
86+
prefix = args.prefix
87+
}))
8488

8589
package.path = conf.lua_package_path .. ";" .. package.path
8690

spec/02-integration/02-cmd/10-migrations_spec.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ for _, strategy in helpers.each_strategy() do
155155
assert.same(0, #stdout)
156156
assert.same(0, #stderr)
157157
end)
158+
159+
it("-p accepts a prefix override", function()
160+
local code, stdout, stderr = run_kong("migrations bootstrap -p /dev/null")
161+
assert.equal(1, code)
162+
assert.equal(0, #stdout)
163+
assert.match("/dev/null is not a directory", stderr, 1, true)
164+
end)
158165
end)
159166

160167
describe("list", function()

0 commit comments

Comments
 (0)