Class: GV::Valley::FileServer
- Inherits:
-
Bedrock::Service
- Object
- Bedrock::Service
- GV::Valley::FileServer
- Includes:
- Common::HostHelper
- Defined in:
- lib/gv/valley/file_server.rb
Defined Under Namespace
Classes: Api, FileSystem
Instance Method Summary collapse
-
#initialize ⇒ FileServer
constructor
A new instance of FileServer.
- #port ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize ⇒ FileServer
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/gv/valley/file_server.rb', line 93 def initialize super ENV['GV_HOME'] ||= GV::Bedrock::Config.service.get("home") runner = Goliath::Runner.new(ARGV, nil) runner.api = Api.new runner.app = Goliath::Rack::Builder.build(Api, runner.api) runner.port = self.port runner.log_file = "/var/log/gv-file_server.log" runner.pid_file = "/var/run/gv-file_server.pid" runner.daemonize = true runner.run at_exit { pid = File.read("/var/run/gv-file_server.pid").chomp.to_i Process.kill("TERM",pid) File.delete("/var/run/gv-file_server.pid") File.delete("/var/log/gv-file_server.log") File.delete("/var/log/gv-file_server.log_stdout.log") } end |
Instance Method Details
#port ⇒ Object
89 90 91 |
# File 'lib/gv/valley/file_server.rb', line 89 def port ENV['PORT'] ||= '9000' end |
#url ⇒ Object
85 86 87 |
# File 'lib/gv/valley/file_server.rb', line 85 def url "http://#{self.external_ip}:#{self.port}" end |