-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vault): make it possible to use vault references in declarative c…
…onfig (#11843) Warmup cache on `init` where we have Lua `coroutines` available so that it won't happen on `init_worker` where we don't have them (and cannot use e.g. lua-resty-http). See KAG-2620 and FTI-5080. Signed-off-by: Aapo Talvensaari <[email protected]> * Update spec/02-integration/02-cmd/02-start_stop_spec.lua --------- Signed-off-by: Aapo Talvensaari <[email protected]> Co-authored-by: Samuele <[email protected]> Signed-off-by: Aapo Talvensaari <[email protected]>
- Loading branch information
Showing
6 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
message: Vault references can be used in Dbless mode in declarative config | ||
type: bugfix | ||
scope: Core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
spec/fixtures/custom_vaults/kong/vaults/mocksocket/init.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
local env = require "kong.vaults.env" | ||
local http = require "resty.luasocket.http" | ||
|
||
|
||
local assert = assert | ||
local getenv = os.getenv | ||
|
||
|
||
local function init() | ||
env.init() | ||
assert(getenv("KONG_PROCESS_SECRETS") == nil, "KONG_PROCESS_SECRETS environment variable found") | ||
assert(env.get({}, "KONG_PROCESS_SECRETS") == nil, "KONG_PROCESS_SECRETS environment variable found") | ||
end | ||
|
||
|
||
local function get(conf, resource, version) | ||
local client, err = http.new() | ||
if not client then | ||
return nil, err | ||
end | ||
|
||
client:set_timeouts(20000, 20000, 20000) | ||
assert(client:request_uri("http://mockbin.org/headers", { | ||
headers = { | ||
Accept = "application/json", | ||
}, | ||
})) | ||
|
||
return env.get(conf, resource, version) | ||
end | ||
|
||
|
||
return { | ||
VERSION = "1.0.0", | ||
init = init, | ||
get = get, | ||
} |
13 changes: 13 additions & 0 deletions
13
spec/fixtures/custom_vaults/kong/vaults/mocksocket/schema.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
return { | ||
name = "mocksocket", | ||
fields = { | ||
{ | ||
config = { | ||
type = "record", | ||
fields = { | ||
{ prefix = { type = "string", match = [[^[%a_][%a%d_]*$]] } }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |