Skip to content

Commit a1157e2

Browse files
author
Isabel Barrera
authored
Adding Development ServerConfig (#798)
1 parent e9414ee commit a1157e2

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

Configs/Secrets.swift.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public enum Secrets {
1111
public enum Endpoint {
1212
public static let production = "api.com"
1313
public static let staging = "api.staging"
14+
public static let development = "api.development"
1415
}
1516
}
1617

@@ -38,5 +39,6 @@ public enum Secrets {
3839
public enum WebEndpoint {
3940
public static let production = "www.kickstarter.com"
4041
public static let staging = "staging.com"
42+
public static let development = "development.kickstarter.com"
4143
}
4244
}

KsApi/ServerConfig.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ public func == (lhs: ServerConfigType, rhs: ServerConfigType) -> Bool {
2424
lhs.environment == rhs.environment
2525
}
2626

27-
public enum EnvironmentType: String {
28-
public static let allCases: [EnvironmentType] = [.production, .staging, .local]
29-
27+
public enum EnvironmentType: String, CaseIterable {
3028
case production = "Production"
3129
case staging = "Staging"
30+
case development = "Development"
3231
case local = "Local"
3332
}
3433

@@ -62,6 +61,16 @@ public struct ServerConfig: ServerConfigType {
6261
environment: EnvironmentType.staging
6362
)
6463

64+
public static let development: ServerConfigType = ServerConfig(
65+
apiBaseUrl: URL(string: "https://\(Secrets.Api.Endpoint.development)")!,
66+
webBaseUrl: URL(string: "https://\(Secrets.WebEndpoint.development)")!,
67+
apiClientAuth: ClientAuth.development,
68+
basicHTTPAuth: BasicHTTPAuth.development,
69+
graphQLEndpointUrl: URL(string: "https://\(Secrets.WebEndpoint.development)")!
70+
.appendingPathComponent(gqlPath),
71+
environment: EnvironmentType.development
72+
)
73+
6574
public static let local: ServerConfigType = ServerConfig(
6675
apiBaseUrl: URL(string: "http://api.ksr.test")!,
6776
webBaseUrl: URL(string: "http://ksr.test")!,
@@ -91,6 +100,8 @@ public struct ServerConfig: ServerConfigType {
91100
switch environment {
92101
case .local:
93102
return ServerConfig.local
103+
case .development:
104+
return ServerConfig.development
94105
case .staging:
95106
return ServerConfig.staging
96107
case .production:

0 commit comments

Comments
 (0)