Add ability to alias secrets for tags
Aliasing for secrets was introduced in #1439, but only supported "top-level" secrets. This adds support for aliasing/mapping secrets for tags.
This commit is contained in:
18
test/configuration/env/tags_test.rb
vendored
18
test/configuration/env/tags_test.rb
vendored
@@ -96,6 +96,24 @@ class ConfigurationEnvTagsTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "aliased tag secret env" do
|
||||
with_test_secrets("secrets" => "PASSWORD=hello\nALIASED_PASSWORD=aliased_hello") do
|
||||
deploy = {
|
||||
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
|
||||
servers: [ { "1.1.1.1" => "secrets" } ],
|
||||
builder: { "arch" => "amd64" },
|
||||
env: {
|
||||
"tags" => {
|
||||
"secrets" => { "secret" => [ "PASSWORD:ALIASED_PASSWORD" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config = Kamal::Configuration.new(deploy)
|
||||
assert_equal "aliased_hello", config.role("web").env("1.1.1.1").secrets["PASSWORD"]
|
||||
end
|
||||
end
|
||||
|
||||
test "tag clear env" do
|
||||
deploy = {
|
||||
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
|
||||
|
||||
Reference in New Issue
Block a user