vagrant-foodshow 0.0.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/vagrant-foodshow/config.rb +10 -0
- data/lib/vagrant-foodshow/util/ngrok.rb +13 -1
- data/lib/vagrant-foodshow/util/ngrok_config.rb +4 -1
- data/lib/vagrant-foodshow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f146d0ff605189d2e409ede395779c9be1d9f282
|
4
|
+
data.tar.gz: 455533e5892334c78b3b900b276f2b53ab502f17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
|