# File lib/dister/core.rb, line 15
    def initialize
      @options ||= Options.new
      @shell = Thor::Shell::Basic.new
      @connection = StudioApi::Connection.new(
        @options.username,
        @options.api_key,
        @options.api_path,
        :proxy   => @options.proxy,           # proxy can be nil
        :timeout => (@options.timeout || 60)  # default to 60s
      )
      # Try the connection once to determine whether credentials are correct.
      @connection.api_version
      StudioApi::Util.configure_studio_connection @connection

      # Ensure app_name is stored for further use.
      if @options.app_name.nil?
        @options.app_name = APP_ROOT.split(/(\/|\\)/).last
      end

      true
    rescue ActiveResource::UnauthorizedAccess
      puts 'A connection to SUSE Studio could not be established.'
      keep_trying = @shell.yes?(
        'Would you like to re-enter your credentials and try again? (y/n)'
      )
      if keep_trying
        update_credentials
        retry
      else
        abort('Exiting dister.')
      end
    end