|
8 | 8 | require "webrick/https" |
9 | 9 | require "openssl" |
10 | 10 |
|
11 | | -webrick_options = { |
12 | | - Host: "0.0.0.0", |
13 | | - Port: 443, |
14 | | - Logger: WEBrick::Log::new($stderr, WEBrick::Log::DEBUG), |
15 | | - SSLEnable: true, |
16 | | - SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE, |
17 | | - SSLCertificate: OpenSSL::X509::Certificate.new(File.read("/acceptance/github-server/ssl.crt")), |
18 | | - SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read("/acceptance/github-server/ssl.key")), |
19 | | - SSLCertName: [["CN", "github.fake"]] |
20 | | -} |
21 | | - |
22 | 11 | class FakeGitHubApi < Sinatra::Base |
| 12 | + use Rack::RewindableInput::Middleware |
| 13 | + |
| 14 | + set :server, %w[webrick] |
| 15 | + set :server_settings, { |
| 16 | + Host: "0.0.0.0", |
| 17 | + Port: 443, |
| 18 | + Logger: WEBrick::Log::new($stderr, WEBrick::Log::DEBUG), |
| 19 | + SSLEnable: true, |
| 20 | + SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE, |
| 21 | + SSLCertificate: OpenSSL::X509::Certificate.new(File.read("/acceptance/github-server/ssl.crt")), |
| 22 | + SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read("/acceptance/github-server/ssl.key")), |
| 23 | + SSLCertName: [["CN", "github.fake"]] |
| 24 | + } |
| 25 | + |
| 26 | + set :port, 443 |
| 27 | + set :bind, "0.0.0.0" |
| 28 | + set :host_authorization, { permitted_hosts: [] } |
| 29 | + |
23 | 30 | BASE_DIR = "/tmp/github" |
24 | 31 |
|
25 | 32 | TEAM_MAP_FILE = File.join(BASE_DIR, "team_map.json") |
@@ -405,4 +412,4 @@ def graphql_pending_query(query) |
405 | 412 | end |
406 | 413 | end |
407 | 414 |
|
408 | | -Rack::Handler::WEBrick.run FakeGitHubApi, **webrick_options |
| 415 | +FakeGitHubApi.run! |
0 commit comments