Review Constants

- Move container names out of Bundle
- Add API web services timeout
This commit is contained in:
Davide 2024-10-10 19:28:01 +02:00
parent 6d6eef43c9
commit 5c91eb4bf1
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
7 changed files with 27 additions and 19 deletions

View File

@ -14,16 +14,10 @@
<string>$(CFG_IAP_BUNDLE_PREFIX)</string>
<key>keychainGroupId</key>
<string>$(CFG_TEAM_ID).$(CFG_GROUP_ID)</string>
<key>profilesContainerName</key>
<string>$(CFG_PROFILES_CONTAINER_NAME)</string>
<key>remoteProfilesContainerName</key>
<string>$(CFG_PROFILES_CONTAINER_NAME).remote</string>
<key>tunnelId</key>
<string>$(CFG_TUNNEL_ID)</string>
<key>legacyV2CloudKitId</key>
<string>$(CFG_LEGACY_V2_CLOUDKIT_ID)</string>
<key>legacyV2ProfilesContainerName</key>
<string>$(CFG_LEGACY_V2_PROFILES_CONTAINER_NAME)</string>
</dict>
<key>CFBundleDocumentTypes</key>
<array>

View File

@ -38,13 +38,11 @@ CFG_GROUP_ID[sdk=iphonesimulator*] = $(CFG_RAW_GROUP_ID)
CFG_GROUP_ID[sdk=macosx*] = $(CFG_TEAM_ID).$(CFG_RAW_GROUP_ID)
CFG_IAP_BUNDLE_PREFIX = com.algoritmico.ios.Passepartout
CFG_INTENTS_ID = $(CFG_APP_ID).Intents
CFG_PROFILES_CONTAINER_NAME = Profiles-v3
CFG_RAW_GROUP_ID = group.com.algoritmico.Passepartout
CFG_TEAM_ID = DTDYD63ZX9
CFG_TUNNEL_ID = $(CFG_APP_ID).Tunnel
CFG_LEGACY_V2_CLOUDKIT_ID = iCloud.com.algoritmico.Passepartout
CFG_LEGACY_V2_PROFILES_CONTAINER_NAME = Profiles
PATH = $(PATH):/opt/homebrew/bin:/usr/local/bin:/usr/local/go/bin
CUSTOM_SCRIPT_PATH = $(PATH)

View File

@ -10,8 +10,6 @@
<string>$(CFG_GROUP_ID)</string>
<key>keychainGroupId</key>
<string>$(CFG_TEAM_ID).$(CFG_GROUP_ID)</string>
<key>profilesContainerName</key>
<string>$(CFG_PROFILES_CONTAINER_NAME)</string>
<key>teamId</key>
<string>$(CFG_TEAM_ID)</string>
<key>tunnelId</key>

View File

@ -42,17 +42,11 @@ extension BundleConfiguration {
case keychainGroupId
case profilesContainerName
case remoteProfilesContainerName
case tunnelId
// legacy v2
case legacyV2CloudKitId
case legacyV2ProfilesContainerName
}
public static var mainDisplayName: String {

View File

@ -27,6 +27,14 @@ import Foundation
import PassepartoutKit
public struct Constants: Decodable, Sendable {
public struct Containers: Decodable, Sendable {
public let local: String
public let remote: String
public let legacyV2: String
}
public struct Websites: Decodable, Sendable {
public let home: URL
@ -83,6 +91,10 @@ public struct Constants: Decodable, Sendable {
public let refreshInterval: TimeInterval
}
public struct API: Decodable, Sendable {
public let timeoutInterval: TimeInterval
}
public struct Log: Decodable, Sendable {
public struct Formatter: Decodable, Sendable {
enum CodingKeys: CodingKey {
@ -126,6 +138,8 @@ public struct Constants: Decodable, Sendable {
public let bundleKey: String
public let containers: Containers
public let websites: Websites
public let emails: Emails
@ -134,5 +148,7 @@ public struct Constants: Decodable, Sendable {
public let connection: Connection
public let api: API
public let log: Log
}

View File

@ -1,5 +1,10 @@
{
"bundleKey": "AppConfig",
"containers": {
"local": "Profiles-v3",
"remote": "Profiles-v3.remote",
"legacyV2": "Profiles"
},
"websites": {
"home": "https://passepartoutvpn.app",
"subreddit": "https://www.reddit.com/r/passepartout/",
@ -18,6 +23,9 @@
"connection": {
"refreshInterval": 3.0
},
"api": {
"timeoutInterval": 5.0
},
"log": {
"appPath": "app.log",
"tunnelPath": "tunnel.log",

View File

@ -50,7 +50,7 @@ extension ProfileManager {
let remoteStore = CoreDataPersistentStore(
logger: .default,
containerName: BundleConfiguration.mainString(for: .remoteProfilesContainerName),
containerName: Constants.shared.containers.remote,
model: AppData.cdProfilesModel,
cloudKitIdentifier: BundleConfiguration.mainString(for: .cloudKitId),
author: nil
@ -127,8 +127,8 @@ extension Tunnel {
private var localProfileRepository: any ProfileRepository {
let store = CoreDataPersistentStore(
logger: .default,
containerName: BundleConfiguration.mainString(for: .profilesContainerName),
model: coreDataModel,
containerName: Constants.shared.containers.local,
model: AppData.cdProfilesModel,
cloudKitIdentifier: nil,
author: nil
)