-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathAppConfiguration.swift
More file actions
33 lines (31 loc) · 1017 Bytes
/
Copy pathAppConfiguration.swift
File metadata and controls
33 lines (31 loc) · 1017 Bytes
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
import ApiClient
import Foundation
/// Resolves the `ServerConfiguration` for the current build.
///
/// This lives in the **app target** (not the CriticalMapsKit package) because the
/// `DEBUG_LOCAL` compile flag is set per build configuration on the app target,
/// where compile flags reliably apply — they do not reliably propagate into
/// integrated Swift Package targets. The resolved value is injected into the
/// package at the app's composition root (see `CriticalMapsApp`).
enum AppConfiguration {
/// Human-readable name of the active environment, for logging.
static var environmentName: String {
#if DEBUG_LOCAL
return "LOCAL (mock server)"
#else
return "PRODUCTION"
#endif
}
static var serverConfiguration: ServerConfiguration {
#if DEBUG_LOCAL
return ServerConfiguration(
scheme: "http",
locationsHost: "localhost",
locationsPort: 8080,
pollIntervalSeconds: 10
)
#else
return .production
#endif
}
}