OSDN Git Service

Allow to change API host for debug.
authorTatsuki Sugiura <sugi@nemui.org>
Mon, 14 Mar 2016 06:08:20 +0000 (15:08 +0900)
committerTatsuki Sugiura <sugi@nemui.org>
Mon, 14 Mar 2016 06:08:20 +0000 (15:08 +0900)
lib/osdn/cli/command/login.rb
lib/osdn/cli/runner.rb

index c8cdadc..ddb3352 100644 (file)
@@ -4,7 +4,7 @@ module OSDN; module CLI; module Command
       logger.debug "Trying login"
       scope = %w(profile group group_write)
 
-      auth_url = "https://osdn.jp/account/oauth2ui/authorize?client_id=#{CLI.client_id}&state=cli#{Time.now.to_i}&response_type=code&scope=#{scope.join('%20')}"
+      auth_url = "https://#{OSDNClient.configure.host}/account/oauth2ui/authorize?client_id=#{CLI.client_id}&state=cli#{Time.now.to_i}&response_type=code&scope=#{scope.join('%20')}"
 
       launch_brwoser auth_url
       puts
index beb3b8d..03e6716 100644 (file)
@@ -11,6 +11,12 @@ module OSDN
         @logger.formatter = proc { |severity, time, progname, msg|
           "[%s] %s\n" % [severity, msg]
         }
+        OSDNClient.configure do |config|
+          ENV['OSDN_API_OVERRIDE_HOST'] and
+            config.host = ENV['OSDN_API_OVERRIDE_HOST']
+          ENV['OSDN_API_SKIP_SSL_VERIFY'].to_s =~ /^(1|t(rue)?|y(es)?)$/ and
+            config.verify_ssl = false
+        end
       end
       attr_reader :logger