bin/oauth2-server in rack-oauth2-server-1.4.5 vs bin/oauth2-server in rack-oauth2-server-1.4.6

- old
+ new

@@ -12,10 +12,14 @@ db = Mongo::Connection.new(uri.host, uri.port)[uri.path.sub(/^\//, "")] db.authenticate uri.user, uri.password if uri.user Server.database = db ARGV[i,2] = [] end +if (i = ARGV.index("--port") || ARGV.index("-p")) && ARGV[i+1] + port = ARGV[i + 1].to_i + ARGV[i,2] = [] +end case ARGV[0] when "list" @@ -108,16 +112,10 @@ exit -1 end require "rack/oauth2/practice" fail "No database. Use the --db option to tell us which database to use" unless Server.database - if (i = ARGV.index("--port")) && ARGV[i+1] - port = ARGV[i + 1].to_i - ARGV[i,2] = [] - end - port = port.nil? || port.empty? ? 8080 : port.to_i - admin_url = "http://localhost:#{port}/oauth/admin" client = Server::Client.lookup(admin_url) unless client client = Server::Client.create(:display_name=>"Practice OAuth Console", :image_url=>"#{admin_url}/images/oauth-2.png", :link=>admin_url, :redirect_uri=>admin_url) @@ -142,9 +140,10 @@ register Register a new client application setup Create new admin account and help you setup the OAuth Web console Options: --db database Database name or connection URL + --port number Port to run admin server, detault is 8080 TEXT exit -1 end