Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit d3f8221

Browse files
Merge pull request #7 from nodes-vapor/updated-ci
Updated CI
2 parents 613e3b9 + d230b45 commit d3f8221

File tree

5 files changed

+30
-14
lines changed

5 files changed

+30
-14
lines changed

.circleci/config.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
jobs:
2+
build:
3+
docker:
4+
- image: buildpack-deps:trusty
5+
steps:
6+
- checkout
7+
- run:
8+
name: Install Swift
9+
command: 'eval "$(curl -sL https://apt.vapor.sh)"'
10+
- run:
11+
name: Install Vapor toolbox
12+
command: |
13+
sudo apt-get install --yes vapor
14+
sudo apt-get install --yes cmysql
15+
sudo chmod -R a+rx /usr/
16+
- run:
17+
name: Run Tests
18+
command: |
19+
swift test -Xswiftc -DNOJSON

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ before_install:
99
brew tap vapor/tap;
1010
brew update;
1111
brew install vapor;
12+
brew install cmysql;
13+
gem install xcpretty;
1214

1315
script:
16+
- set -o pipefail
1417
- swift build
1518
- swift build -c release
1619
- swift package generate-xcodeproj --enable-code-coverage
17-
- xcodebuild -scheme Gatekeeper -enableCodeCoverage YES test
20+
- xcodebuild -scheme Gatekeeper -enableCodeCoverage YES test | xcpretty
1821

1922
after_success:
2023
- bash <(curl -s https://codecov.io/bash)

Sources/RateLimiter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public struct RateLimiter: Middleware {
4646
}
4747

4848
public func respond(to request: Request, chainingTo next: Responder) throws -> Response {
49-
guard let peer = request.peerAddress?.address() else {
49+
guard let peer = request.peerHostname else {
5050
throw Abort(
5151
.forbidden,
5252
metadata: nil,

Tests/GatekeeperTests/GatekeeperTests.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,18 @@ extension GatekeeperTests {
158158
}
159159

160160
func getHTTPRequest() -> Request {
161-
return try! Request(method: .get, uri: "http://localhost:8080/")
161+
return Request(method: .get, uri: "http://localhost:8080/")
162162
}
163163

164164
func getHTTPSRequest() -> Request {
165+
166+
var headers = [HeaderKey: String]()
167+
headers["X-Forwarded-For"] = "192.168.1.2"
168+
165169
return try! Request(
166170
method: .get,
167171
uri: URI("https://localhost:8080/"),
168-
peerAddress: PeerAddress(stream: "192.168.1.2")
172+
headers: headers
169173
)
170174
}
171175
}

circle.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)