bin/phantom_proxy in phantom_proxy-1.1.0 vs bin/phantom_proxy in phantom_proxy-1.2.0
- old
+ new
@@ -22,16 +22,39 @@
:backtrace => true,
:ontop => true,
:log_output => true
}
#Daemons.daemonize(options)
+
+PARAMETERS = Array.new
+
+hmac_key = nil
phantom = false
+last_arg = nil
ARGV.each { |arg|
- phantom = true if /-self/.match(arg)
+ if !/-hmac/.match(arg) && !/-hmac/.match(last_arg) && !/-self/.match(arg)
+ PARAMETERS << arg
+ end
+ phantom = true if /-self/.match(arg)
+ hmac_key = arg if /-hmac/.match(last_arg)
+ last_arg = arg
}
+if hmac_key
+ if !File.directory?("/tmp/phantom_proxy")
+ Dir.mkdir("/tmp/phantom_proxy")
+ end
+
+ File.open("/tmp/phantom_proxy/key", 'w+') {|f| f.write(hmac_key) }
+else
+ begin
+ File.delete("/tmp/phantom_proxy/key")
+ rescue
+ end
+end
+
if !phantom
- startoptions = ["start", "-R", PhantomJSProxy::CONFIG, "-P", "/tmp/pids/phantom_proxy.pid", "--tag", "phantom_proxy"]+ARGV
- Thin::Runner.new(startoptions).run!
+ startoptions = ["start", "-R", PhantomJSProxy::CONFIG, "-P", "/tmp/pids/phantom_proxy.pid", "--tag", "phantom_proxy"]+PARAMETERS
+ runner = Thin::Runner.new(startoptions).run!
else
Thin::Server.start(PhantomJSProxy::PhantomJSServer.new, ARGV[0], ARGV[1], ARGV[2])
end
\ No newline at end of file