some minor updates to the recently-merged 26d6c4f

Denver Gingerich created

* include new copyright line, as the file has an additional author now
* split up the `require` lines a bit as we're not alphabetical anymore
* move/rename the HTTP listen port in the command-line parameters
* revert ARGV change since others missed in 26d6c4f; reordering anyway
* add comment to #write so I remember why it was added to begin with

Change summary

sgx-catapult.rb | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

Detailed changes

sgx-catapult.rb 🔗

@@ -1,6 +1,7 @@
 #!/usr/bin/env ruby
 #
 # Copyright (C) 2017  Denver Gingerich <denver@ossguy.com>
+# Copyright (C) 2017  Stephen Paul Weber <singpolyma@singpolyma.net>
 #
 # This file is part of sgx-catapult.
 #
@@ -22,6 +23,7 @@ require 'json'
 require 'net/http'
 require 'redis/connection/hiredis'
 require 'uri'
+
 require 'goliath/api'
 require 'goliath/server'
 require 'log4r'
@@ -29,8 +31,8 @@ require 'log4r'
 if ARGV.size != 8 then
 	puts "Usage: sgx-catapult.rb <component_jid> <component_password> " +
 		"<server_hostname> <server_port> " +
-		"<http_port> " +
-		"<redis_hostname> <redis_port> <delivery_receipt_url>"
+		"<redis_hostname> <redis_port> <delivery_receipt_url> " +
+		"<http_listen_port>"
 	exit 0
 end
 
@@ -41,6 +43,7 @@ module SGXcatapult
 		client.run
 	end
 
+	# so classes outside this module can write messages, too
 	def self.write(stanza)
 		client.write(stanza)
 	end
@@ -78,7 +81,7 @@ module SGXcatapult
 		cred_key = "catapult_cred-" + bare_jid
 
 		conn = Hiredis::Connection.new
-		conn.connect(ARGV[5], ARGV[6].to_i)
+		conn.connect(ARGV[4], ARGV[5].to_i)
 
 		conn.write ["EXISTS", cred_key]
 		if conn.read == 0
@@ -385,7 +388,7 @@ end
 EM.run do
 	SGXcatapult.run
 
-	server = Goliath::Server.new('127.0.0.1', ARGV[4].to_i)
+	server = Goliath::Server.new('127.0.0.1', ARGV[7].to_i)
 	server.api = WebhookHandler.new
 	server.app = Goliath::Rack::Builder.build(server.api.class, server.api)
 	server.logger = Log4r::Logger.new('goliath')