lib/convox/client.rb in convox_installer-3.0.1 vs lib/convox/client.rb in convox_installer-3.1.0
- old
+ new
@@ -14,11 +14,10 @@
File.expand_path('~/Library/Preferences/convox').freeze
else
File.expand_path('~/.convox').freeze
end
- AUTH_FILE = File.join(CONVOX_CONFIG_DIR, 'auth')
CURRENT_FILE = File.join(CONVOX_CONFIG_DIR, 'current')
attr_accessor :logger, :config
def cli_version_string
@@ -53,14 +52,10 @@
cli_version = Gem::Version.new(cli_version_string)
cli_version >= Gem::Version.new('3.0.0') &&
cli_version < Gem::Version.new('4.0.0')
end
- def auth
- load_auth_from_file
- end
-
def initialize(options = {})
@logger = Logger.new($stdout)
logger.level = options[:log_level] || Logger::INFO
@config = options[:config] || {}
end
@@ -130,20 +125,12 @@
run_convox_command!(command, env, rack_arg: false)
end
def rack_already_installed?
require_config(%i[aws_region stack_name])
-
- return unless File.exist?(AUTH_FILE)
-
- # region = config.fetch(:aws_region)
- stack_name = config.fetch(:stack_name)
return true if File.exist?(rack_dir)
- auth.each do |rack_name, _password|
- return true if rack_name == stack_name
- end
false
end
# Auth for a detached rack is not saved in the auth file anymore.
# It can be found in the terraform state:
@@ -440,19 +427,9 @@
system env, command
raise "Error running: #{command}" unless $CHILD_STATUS.success?
end
private
-
- def load_auth_from_file
- return {} unless File.exist?(AUTH_FILE)
-
- begin
- JSON.parse(File.read(AUTH_FILE))
- rescue StandardError
- {}
- end
- end
def require_config(required_keys)
required_keys.each do |k|
raise "#{k} is missing from the config!" unless config[k]
end