lib/kpm/account.rb in kpm-0.5.2 vs lib/kpm/account.rb in kpm-0.5.3

- old
+ new

@@ -70,11 +70,11 @@ #delimeters to sniff DELIMITERS = [',','|'] DEFAULT_DELIMITER = "|" def initialize(config_file = nil, killbill_api_credentials = nil, killbill_credentials = nil, killbill_url = nil, - database_name = nil, database_credentials = nil, data_delimiter = nil, logger = nil) + database_name = nil, database_credentials = nil, database_host = nil, data_delimiter = nil, logger = nil) @killbill_api_key = KILLBILL_API_KEY @killbill_api_secrets = KILLBILL_API_SECRET @killbill_url = KILLBILL_URL @killbill_user = KILLBILL_USER @killbill_password = KILLBILL_PASSWORD @@ -82,11 +82,11 @@ @logger = logger @tables_id = Hash.new set_killbill_options(killbill_api_credentials,killbill_credentials,killbill_url) - set_database_options(database_name,database_credentials,logger) + set_database_options(database_host,database_name,database_credentials,logger) load_config_from_file(config_file) end @@ -458,11 +458,11 @@ end config_db = @config['database'] if not config_db.nil? - set_database_options(config_db['database'], + set_database_options(config_db['host'],config_db['name'], [config_db['username'],config_db['password']], @logger) end end @@ -477,20 +477,16 @@ end end end - def set_database_options(database_name = nil, database_credentials = nil, logger) + def set_database_options(database_host = nil, database_name = nil, database_credentials = nil, logger) Database.set_logger(logger) - if not database_credentials.nil? - Database.set_credentials(database_credentials[0],database_credentials[1]) - end - - if not database_name.nil? - Database.set_database_name(database_name) - end + Database.set_credentials(database_credentials[0],database_credentials[1]) unless database_credentials.nil? + Database.set_database_name(database_name) unless database_name.nil? + Database.set_host(database_host) unless database_host.nil? Database.set_mysql_command_line end def set_killbill_options(killbill_api_credentials, killbill_credentials, killbill_url) \ No newline at end of file