-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathFernoDefaultConfiguration.swift
70 lines (65 loc) · 2.04 KB
/
FernoDefaultConfiguration.swift
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// FernoConfiguration.swift
// Ferno
//
// Created by Maxim Krouk on 6/12/20.
//
import Vapor
public protocol FernoConfigurationProvider {
var logger: Logger { get }
var basePath: String { get }
var email: String { get }
var privateKey: String { get }
var accessToken: String? { get set }
var tokenExpirationDate: Date? { get set }
var tokenURI: String { get }
}
@available(*, deprecated, renamed: "FernoDefaultConfiguration")
public struct FernoConfiguration: FernoConfigurationProvider {
public let logger: Logger
public let basePath: String
public let email: String
public let privateKey: String
public var accessToken: String?
public var tokenExpirationDate: Date?
public let tokenURI: String = "https://oauth2.googleapis.com/token"
public init(
basePath: String,
email: String,
privateKey: String,
accessToken: String? = nil,
tokenExpriationDate: Date? = nil,
logger: Logger = .init(label: "codes.vapor.ferno")
) {
self.basePath = basePath
self.email = email
self.privateKey = privateKey
self.accessToken = accessToken
self.tokenExpirationDate = tokenExpriationDate
self.logger = logger
}
}
public struct FernoDefaultConfiguration: FernoConfigurationProvider {
public let logger: Logger
public let basePath: String
public let email: String
public let privateKey: String
public var accessToken: String?
public var tokenExpirationDate: Date?
public let tokenURI: String = "https://oauth2.googleapis.com/token"
public init(
basePath: String,
email: String,
privateKey: String,
accessToken: String? = nil,
tokenExpirationDate: Date? = nil,
logger: Logger = .init(label: "codes.vapor.ferno")
) {
self.basePath = basePath
self.email = email
self.privateKey = privateKey
self.accessToken = accessToken
self.tokenExpirationDate = tokenExpirationDate
self.logger = logger
}
}