Skip to content

Instantly share code, notes, and snippets.

@GregSutcliffe
Created November 18, 2014 13:27
Show Gist options
  • Select an option

  • Save GregSutcliffe/fd9fe9f501099558b646 to your computer and use it in GitHub Desktop.

Select an option

Save GregSutcliffe/fd9fe9f501099558b646 to your computer and use it in GitHub Desktop.
diff --git a/modules/tftp/tftp_plugin.rb b/modules/tftp/tftp_plugin.rb
index b1cc82d..8f125b9 100644
--- a/modules/tftp/tftp_plugin.rb
+++ b/modules/tftp/tftp_plugin.rb
@@ -2,9 +2,13 @@ module Proxy::TFTP
class Plugin < ::Proxy::Plugin
plugin :tftp, ::Proxy::VERSION
- http_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
- https_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
+ if Proxy::TFTP::Plugin.settings.http
+ http_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
+ end
+ if Proxy::TFTP::Plugin.settings.https
+ https_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
+ end
default_settings :tftproot => '/var/lib/tftpboot'
end
-end
\ No newline at end of file
+end
with this config in tftp.yml:
---
:enabled: true
:tftproot: /srv/tftp
# Defines the TFTP Servername to use, overrides the name in the subnet declaration
:tftp_servername: 127.0.0.1
:https: false
:http: true
[greg:~]$ curl http://192.168.130.1:8443/tftp/serverName
{"serverName":"127.0.0.1"}
with http: false:
[greg:~]$ curl http://192.168.130.1:8443/tftp/serverName
...
<body>
<h2>Sinatra doesn&rsquo;t know this ditty.</h2>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment