Skip to content

Commit

Permalink
Merge pull request #8 from chibombo/fix/configuration-typo
Browse files Browse the repository at this point in the history
FernoConfiguration.tokenExpirationDate typo fixed
  • Loading branch information
0xTim authored Oct 6, 2023
2 parents 81ea186 + 6b1d48c commit 18649bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Sources/Ferno/FernoClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extension FernoAPIClient {

if let cachedToken = lock.withLock({
if let accessToken = configuration.accessToken,
let tokenExpriationDate = configuration.tokenExpriationDate,
let tokenExpriationDate = configuration.tokenExpirationDate,
Date().timeIntervalSince(tokenExpriationDate) > 30*60 { // should be valid for 1 hour
return accessToken
} else {
Expand Down Expand Up @@ -151,7 +151,7 @@ extension FernoAPIClient {
let res = try await client.send(req).content.decode(OAuthResponse.self)
lock.withLockVoid {
self.configuration.accessToken = res.access_token
self.configuration.tokenExpriationDate = Date().addingTimeInterval(TimeInterval(res.expires_in))
self.configuration.tokenExpirationDate = Date().addingTimeInterval(TimeInterval(res.expires_in))
}
self.configuration.logger.debug("Access token received")
return res.access_token
Expand Down
6 changes: 3 additions & 3 deletions Sources/Ferno/FernoConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ public struct FernoConfiguration {
public let email: String
public let privateKey: String
public var accessToken: String?
public var tokenExpriationDate: Date?
public var tokenExpirationDate: Date?

public init(
basePath: String,
email: String,
privateKey: String,
accessToken: String? = nil,
tokenExpriationDate: Date? = nil,
tokenExpirationDate: Date? = nil,
logger: Logger = .init(label: "codes.vapor.ferno")
) {
self.basePath = basePath
self.email = email
self.privateKey = privateKey
self.accessToken = accessToken
self.tokenExpriationDate = tokenExpriationDate
self.tokenExpirationDate = tokenExpirationDate
self.logger = logger
}
}

0 comments on commit 18649bb

Please sign in to comment.