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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2281a21cf479b89029c45b98996ab6284d4077cbd6c5689c80a5b3eba7a28ee5
4
- data.tar.gz: 2390560f1249e650b178f8fa9986ca12ec06e89c003aab8dc9f68d6e64d8fab3
3
+ metadata.gz: a1361a5b9b6637aa96a0de2f2407bca63f2dd6d253cede1595c2ebac8f55b578
4
+ data.tar.gz: 74f156851335e88d5a36756fb43018e5f498b152cd2a00742cdd6eb425f623dd
5
5
  SHA512:
6
- metadata.gz: 54bbd60fb5e69186de9e2b85d1c9b390d3feda54c074722dae8c2358df5fd6a25a184e8ff237cae08d2dba0628769ee48933abcd0330bf398620e67bde7ae0b0
7
- data.tar.gz: df0487cab9ab8bc0c1f06aa40587ad39ce3e9b3bcea92be45616668f357debb037dda6308dba4c8d24296a95c56d09db4ad77123e5c996e5f12c23851ccb3bf2
6
+ metadata.gz: 43b1f8c585ddd0e4c9f0df96ea243d736ac5e9e565c12382816b6329ad3054746c47b42c72e269bc199daba7985af8d75efcfbeb5ec2bd09b54c2d9877b511aa
7
+ data.tar.gz: b08fe68ed2474db14330819700af6f6d499d2d53d27721becf92cf03cc59a7239fba2c30087bd3bc7bdc552de87ec3a4cad9411fbda71b148488b91a8aea7d23
@@ -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
- key, value = line.chomp.split("=", 2)
151
- next if key.to_s.empty?
151
+ tokens = Shellwords.split(line.chomp)
152
+ tokens.shift if tokens.first == "export"
152
153
 
153
- secrets[key] = value.to_s
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
 
@@ -1,3 +1,3 @@
1
1
  module KamalBackup
2
- VERSION = "0.3.0.beta1"
2
+ VERSION = "0.3.0.beta3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamal-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.beta1
4
+ version: 0.3.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - crmne