brisk 0.2.0 → 0.2.1
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/lib/brisk.rb +3 -3
- data/lib/brisk/caddy.rb +10 -12
- data/lib/brisk/configuration.rb +16 -38
- data/lib/brisk/dnsmasq.rb +10 -11
- data/lib/brisk/file_system.rb +46 -0
- data/lib/brisk/server/brisk_request_helper.rb +3 -1
- data/lib/brisk/server/config.ru +0 -3
- data/lib/brisk/server/pid.rb +9 -5
- data/lib/brisk/server/proxy.rb +11 -8
- data/lib/brisk/server/server.rb +16 -13
- data/lib/brisk/server/site.rb +2 -4
- data/lib/brisk/thin.rb +20 -13
- data/lib/brisk/version.rb +1 -1
- data/stubs/remove_site.plist +19 -0
- metadata +4 -3
- data/lib/brisk/server/https_middleware.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76fbd2e35a7b55d3bd7601cb83f8536c0614f4a6
|
4
|
+
data.tar.gz: aeb7b76485f8cd579b477b8f690ab80837020901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769b4414c67e1a44a74911e9de84625b61a7120361119232d87cd7e4e48016ab8361a192bb15751d925ff345e5dca910d8b0b65e8acf47436db1d09c4cfdf08d
|
7
|
+
data.tar.gz: e5a7a6c482986629f202b79dd294b46682ea89ce0bcb17c38885e9e84a763bf87f87d6940876d708af8209d3269de9f51fd6a13306ef6eee7b721c3a1976ae03
|
data/lib/brisk.rb
CHANGED
@@ -57,7 +57,7 @@ class Valet < Thor
|
|
57
57
|
|
58
58
|
desc "domain DOMAIN", "Sets a new domain"
|
59
59
|
def domain(value)
|
60
|
-
old_domain = Configuration.
|
60
|
+
old_domain = JSON.parse(FileSystem.read(Configuration.path))['domain']
|
61
61
|
|
62
62
|
Configuration.update_domain(value)
|
63
63
|
|
@@ -69,7 +69,7 @@ class Valet < Thor
|
|
69
69
|
|
70
70
|
desc "secure", "Secures the site with a SSL connection"
|
71
71
|
def secure
|
72
|
-
domain = dirname = File.basename(Dir.getwd) + '.' + Configuration.
|
72
|
+
domain = dirname = File.basename(Dir.getwd) + '.' + JSON.parse(FileSystem.read(Configuration.path))['domain']
|
73
73
|
|
74
74
|
Site.secure(domain)
|
75
75
|
Configuration.add('secured', File.basename(Dir.getwd))
|
@@ -80,7 +80,7 @@ class Valet < Thor
|
|
80
80
|
|
81
81
|
desc "unsecure", "Unsecures the site from a SSL connection"
|
82
82
|
def unsecure
|
83
|
-
domain = dirname = File.basename(Dir.getwd) + '.' + Configuration.
|
83
|
+
domain = dirname = File.basename(Dir.getwd) + '.' + JSON.parse(FileSystem.read(Configuration.path))['domain']
|
84
84
|
|
85
85
|
Site.unsecure(domain)
|
86
86
|
Configuration.remove('secured', File.basename(Dir.getwd))
|
data/lib/brisk/caddy.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'brisk/configuration'
|
2
2
|
require 'brisk/constants'
|
3
|
+
require 'brisk/file_system'
|
4
|
+
|
3
5
|
class Caddy
|
4
6
|
|
5
7
|
def self.install
|
@@ -24,26 +26,22 @@ class Caddy
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.install_caddy_file
|
27
|
-
|
28
|
-
file =
|
29
|
+
FileSystem.copy_file(File.expand_path("../../stubs/Caddyfile", __dir__), Constants.valet_home + '/Caddyfile')
|
30
|
+
file = FileSystem.read(Constants.valet_home + '/Caddyfile')
|
29
31
|
new_file = file.gsub("BRISK_HOME_PATH", Constants.valet_home)
|
30
|
-
File.
|
31
|
-
file.write(new_file)
|
32
|
-
end
|
32
|
+
File.write(Constants.valet_home + '/Caddyfile', new_file)
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.install_caddy_directory
|
36
|
-
|
37
|
-
|
36
|
+
FileSystem.create_dir(Constants.valet_home + '/Caddy')
|
37
|
+
FileSystem.create_file(Constants.valet_home + '/Caddy/.keep')
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.install_caddy_daemon
|
41
|
-
path =
|
42
|
-
file =
|
41
|
+
path = FileSystem.get_path("../../stubs/caddy_daemon.plist", __dir__)
|
42
|
+
file = FileSystem.read(path)
|
43
43
|
new_file = file.gsub("BRISK_HOME_PATH", Constants.valet_home)
|
44
|
-
|
45
|
-
file.write(new_file)
|
46
|
-
end
|
44
|
+
FileSystem.write("/Library/LaunchDaemons/com.frankleef.caddyBriskServer.plist", new_file)
|
47
45
|
end
|
48
46
|
|
49
47
|
def self.restart
|
data/lib/brisk/configuration.rb
CHANGED
@@ -1,61 +1,39 @@
|
|
1
1
|
require 'brisk/constants'
|
2
|
+
require 'brisk/file_system'
|
2
3
|
require 'fileutils'
|
3
4
|
require 'json'
|
4
5
|
|
5
6
|
class Configuration
|
6
7
|
|
7
8
|
def self.install
|
8
|
-
create_dir(Constants.valet_home)
|
9
|
-
create_dir(Constants.valet_home + '/Certificates')
|
9
|
+
FileSystem.create_dir(Constants.valet_home)
|
10
|
+
FileSystem.create_dir(Constants.valet_home + '/Certificates')
|
10
11
|
|
11
|
-
unless file_exists?(path)
|
12
|
-
|
12
|
+
unless FileSystem.file_exists?(path)
|
13
|
+
config = {:domain => 'dev', 'paths' => [], 'secured' => []}
|
14
|
+
FileSystem.write(path, config.to_json)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
|
-
def self.create_dir(directory)
|
17
|
-
unless dir_exists?(directory)
|
18
|
-
FileUtils.mkdir_p(directory, :mode => 0755)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.dir_exists?(directory)
|
23
|
-
File.directory?(directory)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.file_exists?(file)
|
27
|
-
File.file?(file)
|
28
|
-
end
|
29
|
-
|
30
18
|
def self.add(key, value)
|
31
|
-
config = read
|
19
|
+
config = JSON.parse(FileSystem.read(Configuration.path))
|
32
20
|
config[key].push(value)
|
33
|
-
write(config)
|
21
|
+
FileSystem.write(Configuration.path, config.to_json)
|
34
22
|
end
|
35
23
|
|
36
24
|
def self.remove(key, value)
|
37
|
-
config = read
|
25
|
+
config = JSON.parse(FileSystem.read(path))
|
38
26
|
config[key].delete_if {|i| i == value}
|
39
|
-
write(config)
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.path
|
43
|
-
return Constants.valet_home + '/config.json'
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.read
|
47
|
-
JSON.parse(File.read(path))
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.write(config)
|
51
|
-
File.open(path, "w+") do |f|
|
52
|
-
f.write(config.to_json)
|
53
|
-
end
|
27
|
+
FileSystem.write(Configuration.path, config.to_json)
|
54
28
|
end
|
55
29
|
|
56
30
|
def self.update_domain(domain)
|
57
|
-
config = read
|
31
|
+
config = JSON.parse(FileSystem.read(path))
|
58
32
|
config['domain'] = domain
|
59
|
-
write(config)
|
33
|
+
FileSystem.write(Configuration.path, config.to_json)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.path
|
37
|
+
return Constants.valet_home + '/config.json'
|
60
38
|
end
|
61
39
|
end
|
data/lib/brisk/dnsmasq.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'colorize'
|
2
|
+
require 'brisk/file_system'
|
2
3
|
|
3
4
|
class DnsMasq
|
4
5
|
|
@@ -41,30 +42,28 @@ class DnsMasq
|
|
41
42
|
|
42
43
|
def self.create_custom_configuration(domain)
|
43
44
|
|
44
|
-
unless
|
45
|
-
|
45
|
+
unless FileSystem.file_exists?(config_path)
|
46
|
+
FileSystem.copy_file(example_config_path,config_path)
|
46
47
|
end
|
47
48
|
|
48
|
-
if
|
49
|
-
|
49
|
+
if FileSystem.read(config_path).index(dnsmasq_path) == nil
|
50
|
+
FileSystem.append(config_path, "conf-file=#{dnsmasq_path}")
|
50
51
|
end
|
51
52
|
|
52
|
-
|
53
|
+
FileSystem.write(dnsmasq_path, "address=/.#{domain}/127.0.0.1")
|
53
54
|
end
|
54
55
|
|
55
56
|
def self.create_resolver(domain)
|
56
|
-
unless
|
57
|
-
|
57
|
+
unless FileSystem.dir_exists?(resolver_path)
|
58
|
+
FileSystem.create_dir(resolver_path)
|
58
59
|
end
|
59
60
|
|
60
61
|
# File.write('etc/resolver/dev', 'nameserver 127.0.0.1')
|
61
|
-
|
62
|
-
f.write('nameserver 127.0.0.1')
|
63
|
-
end
|
62
|
+
File.write("#{resolver_path}/#{domain}", "nameserver 127.0.0.1")
|
64
63
|
end
|
65
64
|
|
66
65
|
def self.update_domain(domain, old_domain)
|
67
|
-
|
66
|
+
FileSystem.delete("#{resolver_path}/#{old_domain}")
|
68
67
|
|
69
68
|
install(domain)
|
70
69
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class FileSystem
|
2
|
+
|
3
|
+
def self.create_dir(directory)
|
4
|
+
unless dir_exists?(directory)
|
5
|
+
FileUtils.mkdir_p(directory, :mode => 0755)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.create_file(file, permissions = 'w')
|
10
|
+
File.new(file, permissions)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.copy_file(from, to)
|
14
|
+
FileUtils.copy(from, to)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get_path(file, path)
|
18
|
+
File.expand_path(file, path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.dir_exists?(directory)
|
22
|
+
File.directory?(directory)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.file_exists?(file)
|
26
|
+
File.file?(file)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.read(path)
|
30
|
+
File.read(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.write(file, value)
|
34
|
+
File.open(file, "w+") do |f|
|
35
|
+
f.write(value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.append(file, value)
|
40
|
+
File.open(file, 'a') { |f| f.puts value}
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.delete(file)
|
44
|
+
File.delete(file)
|
45
|
+
end
|
46
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'brisk/file_system'
|
2
|
+
|
1
3
|
class BriskRequestHelper
|
2
4
|
|
3
5
|
def initialize(env)
|
@@ -16,6 +18,6 @@ class BriskRequestHelper
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def get_config
|
19
|
-
config = JSON.parse(
|
21
|
+
config = JSON.parse(FileSystem.read(valet_home_path + '/config.json'))
|
20
22
|
end
|
21
23
|
end
|
data/lib/brisk/server/config.ru
CHANGED
data/lib/brisk/server/pid.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
+
require 'brisk/file_system'
|
2
|
+
|
1
3
|
class Pid
|
2
4
|
|
5
|
+
def self.get(port)
|
6
|
+
`sudo lsof -i tcp:#{port} | grep ruby | awk '{ print $2; }'`
|
7
|
+
end
|
8
|
+
|
3
9
|
def self.write(path, pid)
|
4
|
-
|
5
|
-
f.write(pid)
|
6
|
-
end
|
10
|
+
FileSystem.write("#{path}/pid.txt", pid)
|
7
11
|
|
8
12
|
sleep(1)
|
9
13
|
end
|
10
14
|
|
11
15
|
def self.read(path)
|
12
|
-
|
16
|
+
FileSystem.read("#{path}/tmp/pids/thin.pid")
|
13
17
|
end
|
14
18
|
|
15
19
|
def self.exists?(path)
|
16
|
-
|
20
|
+
FileSystem.file_exists?("#{path}/tmp/pids/thin.pid")
|
17
21
|
end
|
18
22
|
|
19
23
|
def self.alive?(pid)
|
data/lib/brisk/server/proxy.rb
CHANGED
@@ -19,6 +19,13 @@ class AppProxy < Rack::Proxy
|
|
19
19
|
config = request.get_config
|
20
20
|
site_path = Site.get_site_paths(config, site)
|
21
21
|
|
22
|
+
port = "3001"
|
23
|
+
port = "3003" if Site.is_secured?(config, site)
|
24
|
+
|
25
|
+
# Check if site is running
|
26
|
+
# check if site is equal to written site
|
27
|
+
# Check if site is secured
|
28
|
+
# otherwise, kill process
|
22
29
|
# Kill existing servers, so we don't get conflitcs
|
23
30
|
if Server.is_running(valet_home_path)
|
24
31
|
|
@@ -34,7 +41,7 @@ class AppProxy < Rack::Proxy
|
|
34
41
|
return env
|
35
42
|
end
|
36
43
|
|
37
|
-
existing_pid =
|
44
|
+
existing_pid = Pid.get(port)
|
38
45
|
Server.shutdown(existing_pid)
|
39
46
|
end
|
40
47
|
|
@@ -43,12 +50,10 @@ class AppProxy < Rack::Proxy
|
|
43
50
|
|
44
51
|
Server.start_https(site_path)
|
45
52
|
# Check if proccess is up and running
|
46
|
-
started = Server.is_started(site_path)
|
53
|
+
started = Server.is_started(site_path, port)
|
47
54
|
|
48
|
-
|
55
|
+
# Write the pid to a file so we can delete it later on
|
49
56
|
if started
|
50
|
-
pid = Pid.read(site_path)
|
51
|
-
Pid.write(valet_home_path, pid)
|
52
57
|
Site.write_site(valet_home_path, site)
|
53
58
|
end
|
54
59
|
|
@@ -64,12 +69,10 @@ class AppProxy < Rack::Proxy
|
|
64
69
|
Server.start(site_path)
|
65
70
|
|
66
71
|
# Check if proccess is up and running
|
67
|
-
started = Server.is_started(site_path)
|
72
|
+
started = Server.is_started(site_path, port)
|
68
73
|
|
69
74
|
# Write the pid to a file so we can delete it later on
|
70
75
|
if started
|
71
|
-
pid = Pid.read(site_path)
|
72
|
-
Pid.write(valet_home_path, pid)
|
73
76
|
Site.write_site(valet_home_path, site)
|
74
77
|
end
|
75
78
|
|
data/lib/brisk/server/server.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
require 'brisk/server/pid'
|
2
|
+
require 'brisk/file_system'
|
2
3
|
|
3
4
|
class Server
|
4
5
|
|
5
6
|
def self.is_running(path)
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.read(path)
|
10
|
-
File.read("#{path}/pid.txt")
|
7
|
+
FileSystem.file_exists?("#{path}/pid.txt")
|
11
8
|
end
|
12
9
|
|
13
10
|
def self.kill(path)
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
http = Pid.get("3001")
|
12
|
+
https = Pid.get("3003")
|
13
|
+
unless http.nil?
|
14
|
+
shutdown http
|
15
|
+
end
|
16
|
+
|
17
|
+
unless https.nil?
|
18
|
+
shutdown https
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -25,17 +27,18 @@ class Server
|
|
25
27
|
spawn "cd #{path} && /usr/local/bin/thin start -d -R config.ru -a localhost -p 3003 --ssl"
|
26
28
|
end
|
27
29
|
|
28
|
-
def self.is_started(path,
|
30
|
+
def self.is_started(path, port)
|
29
31
|
sleep(0.5)
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
|
33
|
+
pid = Pid.get(port)
|
34
|
+
|
35
|
+
unless pid.nil?
|
33
36
|
if Pid.alive?(pid)
|
34
37
|
return true
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
38
|
-
is_started(path,
|
41
|
+
is_started(path, port)
|
39
42
|
end
|
40
43
|
|
41
44
|
def self.shutdown(pid)
|
data/lib/brisk/server/site.rb
CHANGED
@@ -6,14 +6,12 @@ class Site
|
|
6
6
|
def self.secure(url)
|
7
7
|
unsecure(url)
|
8
8
|
|
9
|
-
|
9
|
+
FileSystem.create_dir(certificates_path)
|
10
10
|
create_certificate(url)
|
11
11
|
|
12
12
|
caddy_file = build_secure_caddy_file(url)
|
13
13
|
|
14
|
-
|
15
|
-
f.write(caddy_file)
|
16
|
-
end
|
14
|
+
FileSystem.write("#{Constants.valet_home}/Caddy/#{url}", caddy_file)
|
17
15
|
end
|
18
16
|
|
19
17
|
def self.create_certificate(url)
|
data/lib/brisk/thin.rb
CHANGED
@@ -16,7 +16,7 @@ class Thin
|
|
16
16
|
|
17
17
|
install_daemon
|
18
18
|
install_secure_daemon
|
19
|
-
|
19
|
+
install_site_daemon
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.update
|
@@ -26,27 +26,32 @@ class Thin
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.install_daemon
|
29
|
-
path =
|
30
|
-
server =
|
29
|
+
path = FileSystem.get_path("../../stubs/daemon.plist", __dir__)
|
30
|
+
server = FileSystem.get_path("server/config.ru", __dir__)
|
31
31
|
|
32
|
-
file =
|
32
|
+
file = FileSystem.read(path)
|
33
33
|
|
34
34
|
new_file = file.gsub("SERVER_PATH", server)
|
35
|
-
|
36
|
-
|
37
|
-
end
|
35
|
+
|
36
|
+
FileSystem.write("/Library/LaunchDaemons/com.frankleef.briskServer.plist", new_file)
|
38
37
|
end
|
39
38
|
|
40
39
|
def self.install_secure_daemon
|
41
|
-
path =
|
42
|
-
server =
|
40
|
+
path = FileSystem.get_path("../../stubs/secure_daemon.plist", __dir__)
|
41
|
+
server = FileSystem.get_path("server/config.ru", __dir__)
|
43
42
|
|
44
|
-
file =
|
43
|
+
file = FileSystem.read(path)
|
45
44
|
|
46
45
|
new_file = file.gsub("SERVER_PATH", server)
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
FileSystem.write("/Library/LaunchDaemons/com.frankleef.briskSecureServer.plist", new_file)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.install_site_daemon
|
50
|
+
path = FileSystem.get_path("../../stubs/remove_site.plist", __dir__)
|
51
|
+
file = FileSystem.read(path)
|
52
|
+
|
53
|
+
new_file = file.gsub("USER", ENV["HOME"])
|
54
|
+
FileSystem.write("/Library/LaunchDaemons/com.frankleef.removeSite.plist", new_file)
|
50
55
|
end
|
51
56
|
|
52
57
|
def self.download
|
@@ -70,10 +75,12 @@ class Thin
|
|
70
75
|
def self.start
|
71
76
|
system "launchctl load /Library/LaunchDaemons/com.frankleef.briskServer.plist > /dev/null"
|
72
77
|
system "launchctl load /Library/LaunchDaemons/com.frankleef.briskSecureServer.plist > /dev/null"
|
78
|
+
system "launchctl load /Library/LaunchDaemons/com.frankleef.removeSite.plist > /dev/null"
|
73
79
|
end
|
74
80
|
|
75
81
|
def self.stop
|
76
82
|
system "launchctl unload /Library/LaunchDaemons/com.frankleef.briskServer.plist > /dev/null"
|
77
83
|
system "launchctl unload /Library/LaunchDaemons/com.frankleef.briskSecureServer.plist > /dev/null"
|
84
|
+
system "launchctl unload /Library/LaunchDaemons/com.frankleef.removeSite.plist > /dev/null"
|
78
85
|
end
|
79
86
|
end
|
data/lib/brisk/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>Label</key>
|
6
|
+
<string>com.frankleef.removeSite</string>
|
7
|
+
<key>ProgramArguments</key>
|
8
|
+
<array>
|
9
|
+
<string>rm</string>
|
10
|
+
<string>USER/.brisk/site.txt</string>
|
11
|
+
</array>
|
12
|
+
<key>RunAtLoad</key>
|
13
|
+
<true/>
|
14
|
+
<key>StandardOutput</key>
|
15
|
+
<string>/tmp/com.frankleef.removeSite.out</string>
|
16
|
+
<key>StandardErrorPath</key>
|
17
|
+
<string>/tmp/com.frankleef.removeSite.err</string>
|
18
|
+
</dict>
|
19
|
+
</plist>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,10 +122,10 @@ files:
|
|
122
122
|
- lib/brisk/configuration.rb
|
123
123
|
- lib/brisk/constants.rb
|
124
124
|
- lib/brisk/dnsmasq.rb
|
125
|
+
- lib/brisk/file_system.rb
|
125
126
|
- lib/brisk/rerun.rb
|
126
127
|
- lib/brisk/server/brisk_request_helper.rb
|
127
128
|
- lib/brisk/server/config.ru
|
128
|
-
- lib/brisk/server/https_middleware.rb
|
129
129
|
- lib/brisk/server/pid.rb
|
130
130
|
- lib/brisk/server/proxy.rb
|
131
131
|
- lib/brisk/server/server.rb
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- stubs/Caddyfile
|
137
137
|
- stubs/caddy_daemon.plist
|
138
138
|
- stubs/daemon.plist
|
139
|
+
- stubs/remove_site.plist
|
139
140
|
- stubs/secureCaddyfile
|
140
141
|
- stubs/secure_daemon.plist
|
141
142
|
homepage: https://www.github.com/frankieleef/brisk
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'brisk/server/site'
|
2
|
-
require 'brisk/server/brisk_request_helper'
|
3
|
-
class HttpsMiddleware
|
4
|
-
|
5
|
-
def initialize(app)
|
6
|
-
@app = app
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
request = BriskRequestHelper.new env
|
11
|
-
site = request.get_site
|
12
|
-
#
|
13
|
-
# return @app.call(env) unless Site.is_secured?(site)
|
14
|
-
|
15
|
-
|
16
|
-
@app.call(env)
|
17
|
-
end
|
18
|
-
end
|