Module: Mayu::Server
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/server.rb,
lib/mayu/server/app.rb,
lib/mayu/server/errors.rb,
lib/mayu/server/controller.rb,
lib/mayu/server/file_server.rb
Defined Under Namespace
Modules: Errors
Classes: App, Controller, FileServer
Class Method Summary
collapse
Class Method Details
.setup_self_signed_cert(config) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/mayu/server.rb', line 49
def self.setup_self_signed_cert(config)
return unless config.server.self_signed_cert
authority = Localhost::Authority.fetch(config.server.host)
authority.server_context.tap do |context|
context.alpn_select_cb = lambda { |_| "h2" }
lambda { |protocols| protocols.include?("h2") ? "h2" : nil }
context.alpn_protocols = ["h2"]
context.session_id_context = "mayu"
end
end
|
.start(config) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/mayu/server.rb', line 33
def self.start(config)
uri = config.server.uri
ssl_context = setup_self_signed_cert(config)
endpoint = Async::HTTP::Endpoint.new(uri, ssl_context:, reuse_port: true)
Configuration.log_config(config)
Process.setproctitle("mayu #{config.mode} file://#{config.root} #{uri}")
Controller.new(config:, endpoint:).run
end
|
.start_dev(config) ⇒ Object
27
|
# File 'lib/mayu/server.rb', line 27
def self.start_dev(config) = start(config)
|
.start_prod(config) ⇒ Object
30
|
# File 'lib/mayu/server.rb', line 30
def self.start_prod(config) = start(config)
|