kamal-backup 0.3.0.beta1 → 0.3.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kamal_backup/config.rb +12 -0
- data/lib/kamal_backup/kamal_bridge.rb +9 -3
- data/lib/kamal_backup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a1361a5b9b6637aa96a0de2f2407bca63f2dd6d253cede1595c2ebac8f55b578
|
|
4
|
+
data.tar.gz: 74f156851335e88d5a36756fb43018e5f498b152cd2a00742cdd6eb425f623dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 43b1f8c585ddd0e4c9f0df96ea243d736ac5e9e565c12382816b6329ad3054746c47b42c72e269bc199daba7985af8d75efcfbeb5ec2bd09b54c2d9877b511aa
|
|
7
|
+
data.tar.gz: b08fe68ed2474db14330819700af6f6d499d2d53d27721becf92cf03cc59a7239fba2c30087bd3bc7bdc552de87ec3a4cad9411fbda71b148488b91a8aea7d23
|
data/lib/kamal_backup/config.rb
CHANGED
|
@@ -592,6 +592,8 @@ module KamalBackup
|
|
|
592
592
|
end
|
|
593
593
|
end
|
|
594
594
|
|
|
595
|
+
env.merge!(normalize_yaml_restic_rest(hash["rest"], raw_env: raw_env, path: path)) if hash.key?("rest")
|
|
596
|
+
|
|
595
597
|
{
|
|
596
598
|
"init_if_missing" => "RESTIC_INIT_IF_MISSING",
|
|
597
599
|
"check_after_backup" => "RESTIC_CHECK_AFTER_BACKUP",
|
|
@@ -635,6 +637,16 @@ module KamalBackup
|
|
|
635
637
|
end
|
|
636
638
|
end
|
|
637
639
|
|
|
640
|
+
def normalize_yaml_restic_rest(raw_value, raw_env:, path:)
|
|
641
|
+
hash = require_mapping(raw_value, "#{path} restic.rest")
|
|
642
|
+
env = {}
|
|
643
|
+
username = hash.key?("username") ? hash["username"] : hash["user"]
|
|
644
|
+
|
|
645
|
+
env["RESTIC_REST_USERNAME"] = resolve_yaml_value(username, raw_env: raw_env, context: "#{path} restic.rest.username") if username
|
|
646
|
+
env["RESTIC_REST_PASSWORD"] = resolve_yaml_value(hash["password"], raw_env: raw_env, context: "#{path} restic.rest.password") if hash.key?("password")
|
|
647
|
+
env.compact
|
|
648
|
+
end
|
|
649
|
+
|
|
638
650
|
def normalize_yaml_backup(raw_value, path:)
|
|
639
651
|
hash = require_mapping(raw_value, "#{path} backup")
|
|
640
652
|
env = {}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "shellwords"
|
|
1
2
|
require "yaml"
|
|
2
3
|
require_relative "command"
|
|
3
4
|
|
|
@@ -147,10 +148,15 @@ module KamalBackup
|
|
|
147
148
|
|
|
148
149
|
def parse_secret_output(output)
|
|
149
150
|
output.to_s.lines.each_with_object({}) do |line, secrets|
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
tokens = Shellwords.split(line.chomp)
|
|
152
|
+
tokens.shift if tokens.first == "export"
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
tokens.each do |assignment|
|
|
155
|
+
key, value = assignment.split("=", 2)
|
|
156
|
+
next if key.to_s.empty? || value.nil?
|
|
157
|
+
|
|
158
|
+
secrets[key] = value.to_s
|
|
159
|
+
end
|
|
154
160
|
end
|
|
155
161
|
end
|
|
156
162
|
|
data/lib/kamal_backup/version.rb
CHANGED