Skip to content

Commit

Permalink
match repo url by prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon committed Dec 26, 2024
1 parent 4a532ac commit 4a95da2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
helmsnap (1.2.1)
helmsnap (1.2.2)
colorize

GEM
Expand Down
6 changes: 3 additions & 3 deletions lib/helmsnap/config.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Helmsnap::Config
Credentials = Struct.new(:username, :password)
Credentials = Struct.new(:repo, :username, :password)

attr_reader :envs, :snapshots_path, :credentials

Expand Down Expand Up @@ -34,8 +34,8 @@ def parse_snaphots_path(yaml)
end

def parse_credentials(yaml)
yaml.fetch("credentials", []).each_with_object({}) do |obj, credentials|
credentials[obj["repo"]] = Credentials.new(obj["username"], obj["password"])
yaml.fetch("credentials", []).map do |obj|
Credentials.new(obj["repo"], obj["username"], obj["password"])
end
end
end
2 changes: 1 addition & 1 deletion lib/helmsnap/setup_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def setup!(chart_path)
dep_list.scan(%r{(https?://.+?)\s}) do |dep_path|
url = dep_path.first

if (credentials = config.credentials[url])
if (credentials = config.credentials.find { |x| url.start_with?(x.repo) })
extra_args = ["--username", credentials.username, "--password", credentials.password]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/helmsnap/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Helmsnap
VERSION = "1.2.1"
VERSION = "1.2.2"
end

0 comments on commit 4a95da2

Please sign in to comment.