Skip to content

Commit

Permalink
add: configuration optional for default value apiURL
Browse files Browse the repository at this point in the history
  • Loading branch information
wibed committed Oct 1, 2020
1 parent 8ecd38a commit d402155
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 7 additions & 4 deletions Sources/SendGridKit/SendGridConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import NIOHTTP1


public struct SendGridConfiguration {
public var apiURL: String
public var apiURL: String = ProcessInfo.processInfo
.environment["SENDGRID_URL"] ?? "https://api.sendgrid.com/v3/mail/send"

public var apiKey: String

public init(
apiURL: String = ProcessInfo.processInfo.environment["SENDGRID_URL"] ??
"https://api.sendgrid.com/v3/mail/send",
apiURL: String?,
apiKey: String = ProcessInfo.processInfo.environment["SENDGRID_KEY"]!
){
self.apiURL = apiURL
if let apiURL = apiURL {
self.apiURL = apiURL
}
self.apiKey = apiKey
}
}
5 changes: 0 additions & 5 deletions Tests/SendGridKitTests/SendGridTestsKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ class SendGridKitTests: XCTestCase {
XCTAssertTrue(true)
}


func testApp() {
var app = Application()
defer { app.shutdown() }
}
}

0 comments on commit d402155

Please sign in to comment.