Add secrets-common for shared secrets
Add a shared secrets file used across all destinations. Useful for things Github tokens or registry passwords. The secrets are added to a new file called `secrets-common` to highlight they are shared, and to avoid acciedentally inheriting a secret from the `secrets` file to `secrets.destination`.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
SECRET_TOKEN='1234 with "中文"'
|
||||
SECRET_TAG='TAGME'
|
||||
SECRETS=$(kamal secrets fetch --adapter test --account test INTERPOLATED_SECRET1 INTERPOLATED_SECRET2 INTERPOLATED_中文)
|
||||
INTERPOLATED_SECRET1=$(kamal secrets extract INTERPOLATED_SECRET1 ${SECRETS})
|
||||
INTERPOLATED_SECRET2=$(kamal secrets extract INTERPOLATED_SECRET2 ${SECRETS})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
SECRET_TOKEN='1234 with "中文"'
|
||||
SECRET_TAG='TAGME'
|
||||
@@ -21,10 +21,14 @@ class SecretsTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "destinations" do
|
||||
with_test_secrets("secrets.dest" => "SECRET=DEF", "secrets" => "SECRET=ABC") do
|
||||
with_test_secrets("secrets.dest" => "SECRET=DEF", "secrets" => "SECRET=ABC", "secrets-common" => "SECRET=GHI\nSECRET2=JKL") do
|
||||
assert_equal "ABC", Kamal::Secrets.new["SECRET"]
|
||||
assert_equal "DEF", Kamal::Secrets.new(destination: "dest")["SECRET"]
|
||||
assert_equal "ABC", Kamal::Secrets.new(destination: "nodest")["SECRET"]
|
||||
assert_equal "GHI", Kamal::Secrets.new(destination: "nodest")["SECRET"]
|
||||
|
||||
assert_equal "JKL", Kamal::Secrets.new["SECRET2"]
|
||||
assert_equal "JKL", Kamal::Secrets.new(destination: "dest")["SECRET2"]
|
||||
assert_equal "JKL", Kamal::Secrets.new(destination: "nodest")["SECRET2"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user