vagrant-foodshow 0.0.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2c18e133d54680de1cff45b980bcec79a66bb11
4
- data.tar.gz: b87f5cd17a303d0cd5e1f4839bf8c6a1f4e4bb1d
3
+ metadata.gz: f146d0ff605189d2e409ede395779c9be1d9f282
4
+ data.tar.gz: 455533e5892334c78b3b900b276f2b53ab502f17
5
5
  SHA512:
6
- metadata.gz: d278adae5aa813ebb71938f38695de830be8477506d2d22056a8bf016bfd7a0dac98e6c7e26fc786bd69005d1597af7d9cd9cc94a03627258eaf2922691c24c5
7
- data.tar.gz: e47a40018a2de86eacd1d0a0066fc5f4381674ec10857668438db91b8040d7e4e6748a4ae890e2eb7cafaab432f4f9e3953e3c6fa6c6e8821cccfa163a396271
6
+ metadata.gz: 0c8cc0f7499bf6aeda07a578a1ccb03881ca9c268f2aa2f84983f561602c4d2e03e6672ef3435d26ed5474e60e85275f06ba1e7ee347670af3c628064a53b8c0
7
+ data.tar.gz: 99d663cea9e2df4bc40e453b8c9a3f8612f64091b00759518f4fb00cf0a9c839124fe1b7fe0b720f347e21dde9f6c8ae7121514ed55e6ded60993b6218256834
data/README.md CHANGED
@@ -101,6 +101,28 @@ Vagrant.configure("2") do |config|
101
101
  end
102
102
  end
103
103
  ```
104
+
105
+ ### Self-hosted tunnel example
106
+
107
+ ```ruby
108
+ Vagrant.configure("2") do |config|
109
+ #Enable foodshow
110
+ config.foodshow.enabled = true
111
+ # Set your ngrokd server
112
+ config.foodshow.server_addr = "127.0.0.1:4443"
113
+ # Allow host root certificate
114
+ config.foodshow.trust_host_root_certs = true
115
+ ...
116
+ # Define vm
117
+ config.vm.define :web01 do |conf|
118
+ ...
119
+ #Just add ngrok_proto parameter to your port forwarding entry
120
+ conf.vm.network :forwarded_port, guest: 80, host: 8080, ngrok_proto: "http+https"
121
+ ...
122
+ end
123
+ end
124
+ ```
125
+ Read this document if you want to start self-hosted server https://github.com/inconshreveable/ngrok/blob/master/docs/SELFHOSTING.md
104
126
  ### Options
105
127
 
106
128
  - Scope *config* means that this option can be set only via `foodshow.<options>`
@@ -120,6 +142,8 @@ Option | Default | Scope | Purpose
120
142
  `host_ip` | `127.0.0.1` | tunnel | Custom destination ip for tunnel
121
143
  `inspect_addr` | `127.0.0.1` | config | Address for traffic inspection
122
144
  `inspect_pbase` | `4040` | config | Base port for traffic inspection, other ngrok processes will use the next available port
145
+ `server_addr` | `nil` | config+tunnel | Server address for self-hosted ngrokd, see [Self-hosted tunnels example](#self-hosted-tunnel-example)
146
+ `trust_host_root_certs` | `nil` | config+tunnel | Allow ngrok accept root server certificate. Must be `true` if you using self-hosted ngrokd
123
147
 
124
148
  # Authors
125
149
 
@@ -2,6 +2,9 @@ module VagrantPlugins
2
2
  module Foodshow
3
3
  class Config < Vagrant.plugin(2, :config)
4
4
 
5
+ attr_accessor :server_addr
6
+ attr_accessor :trust_host_root_certs
7
+
5
8
  attr_accessor :timeout
6
9
  attr_accessor :enabled
7
10
  attr_accessor :forward_ssh
@@ -30,6 +33,10 @@ module VagrantPlugins
30
33
  @hostname = UNSET_VALUE
31
34
  @httpauth = UNSET_VALUE
32
35
  @subdomain = UNSET_VALUE
36
+
37
+ # Options for self-hosted ngrokd
38
+ @server_addr = UNSET_VALUE
39
+ @trust_host_root_certs = UNSET_VALUE
33
40
  end
34
41
 
35
42
  def tunnel(port, proto = "http+https", options={})
@@ -82,6 +89,9 @@ module VagrantPlugins
82
89
  def finalize!
83
90
  @ngrok_bin = ::File.expand_path('~/bin/ngrok') if @ngrok_bin == UNSET_VALUE
84
91
 
92
+ @trust_host_root_certs = nil if @trust_host_root_certs == UNSET_VALUE
93
+ @server_addr = nil if @server_addr == UNSET_VALUE
94
+
85
95
  @enabled = false if @enabled == UNSET_VALUE
86
96
  @forward_ssh = false if @forward_ssh == UNSET_VALUE
87
97
  @timeout = 10 if @timeout == UNSET_VALUE
@@ -13,7 +13,11 @@ module VagrantPlugins
13
13
  @@counter = 0
14
14
  end
15
15
 
16
- config = VagrantPlugins::Foodshow::Util::NgrokConfig.merge_config(env, tunnel)
16
+ config = VagrantPlugins::Foodshow::Util::NgrokConfig.merge_config(env, tunnel)
17
+
18
+ trust_host_root_certs = config.delete(:trust_host_root_certs)
19
+ server_addr = config.delete(:server_addr)
20
+
17
21
  timeout = config.delete(:timeout)
18
22
  log_file = config.delete(:log_file)
19
23
  pid_file = config.delete(:pid_file)
@@ -36,6 +40,14 @@ module VagrantPlugins
36
40
 
37
41
  conf_h.write("inspect_addr: #{inspect_addr.to_s}:#{inspect_pbase.to_i + @@counter}\n")
38
42
 
43
+ if server_addr
44
+ conf_h.write("server_addr: #{server_addr}\n")
45
+ end
46
+
47
+ if trust_host_root_certs == true
48
+ conf_h.write("trust_host_root_certs: true\n")
49
+ end
50
+
39
51
  if authtoken
40
52
  conf_h.write("auth_token: #{authtoken}\n")
41
53
  end
@@ -2,7 +2,7 @@ module VagrantPlugins
2
2
  module Foodshow
3
3
  module Util
4
4
  class NgrokConfig
5
- NGROK_ALLOWED_OPTIONS = %w(authtoken hostname httpauth proto subdomain host port)
5
+ NGROK_ALLOWED_OPTIONS = %w(authtoken hostname httpauth proto subdomain host port server_addr trust_host_root_certs)
6
6
 
7
7
  def self.build_cmd(config)
8
8
  cmd = config.delete(:ngrok_bin) + " -log=stdout"
@@ -28,6 +28,9 @@ module VagrantPlugins
28
28
  config = {}
29
29
  foodshow_config = env[:machine].config.foodshow
30
30
 
31
+ config[:trust_host_root_certs] = foodshow_config.trust_host_root_certs if foodshow_config.trust_host_root_certs
32
+ config[:server_addr] = foodshow_config.server_addr if foodshow_config.server_addr
33
+
31
34
  config[:ngrok_bin] = foodshow_config.ngrok_bin if foodshow_config.ngrok_bin
32
35
  config[:timeout] = foodshow_config.timeout if foodshow_config.timeout
33
36
 
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Foodshow
3
- VERSION = "0.0.8"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-foodshow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Borzykh