Move all config validation to main object
This commit is contained in:
@@ -1,13 +1,5 @@
|
|||||||
class Mrsk::Commands::Registry < Mrsk::Commands::Base
|
class Mrsk::Commands::Registry < Mrsk::Commands::Base
|
||||||
def login
|
def login
|
||||||
ensure_credentials_present
|
|
||||||
"docker login #{config.registry["server"]} -u #{config.registry["username"]} -p #{config.registry["password"]}"
|
"docker login #{config.registry["server"]} -u #{config.registry["username"]} -p #{config.registry["password"]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def ensure_credentials_present
|
|
||||||
unless config.registry && config.registry["username"].present? && config.registry["password"].present?
|
|
||||||
raise ArgumentError, "You must configure registry/username and registry/password"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ class Mrsk::Configuration
|
|||||||
%i[ service image registry ].each do |key|
|
%i[ service image registry ].each do |key|
|
||||||
raise ArgumentError, "Missing required configuration for #{key}" unless config[key].present?
|
raise ArgumentError, "Missing required configuration for #{key}" unless config[key].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
%w[ username password ].each do |key|
|
||||||
|
raise ArgumentError, "Missing required configuration for registry/#{key}" unless config.registry[key].present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def parameterize(param, hash)
|
def parameterize(param, hash)
|
||||||
|
|||||||
Reference in New Issue
Block a user