-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathagoo-https.rb
More file actions
37 lines (31 loc) 路 1.15 KB
/
Copy pathagoo-https.rb
File metadata and controls
37 lines (31 loc) 路 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
# agoo -d /srv/http -b http://127.0.0.2:8080 -p 8080 -t 2 -w 1 -v
require 'agoo'
# Optionally configure what you want to be displayed
# https://rubydoc.info/gems/agoo/Agoo/Log#configure-class_method
Agoo::Log.configure(dir: '.',
console: true,
classic: true,
colorize: true,
states: {
ERROR: true,
WARN: true,
INFO: true,
DEBUG: true,
connect: false,
request: true,
response: false,
eval: false,
push: false
})
# https://rubydoc.info/gems/agoo/Agoo/Server#init-class_method
Agoo::Server.init(8080, '/srv/http', thread_count: 2, worker_count: 1, bind: ['http://:8080', 'https://127.0.0.2:4343'], ssl_cert: 'server.crt', ssl_key: 'server.key')
class DataLogger
def call(_req)
[200, {}, ['codered']]
end
end
handler = DataLogger.new
Agoo::Server.handle(:GET, '/**/*', handler)
Agoo::Server.handle(:POST, '/data', handler)
Agoo::Server.start