Commit
This commit is contained in:
41
Sources/PediFoods/Services/ApiConfig.swift
Normal file
41
Sources/PediFoods/Services/ApiConfig.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
import Foundation
|
||||
|
||||
enum ApiModule: Sendable {
|
||||
case app
|
||||
case customer
|
||||
case store
|
||||
case resource
|
||||
case none
|
||||
}
|
||||
|
||||
enum ApiConfig {
|
||||
static var baseURL: URL {
|
||||
let raw = ProcessInfo.processInfo.environment["ATOMENTA_API_URL"] ?? "https://atomenta.com.br"
|
||||
return URL(string: raw) ?? URL(string: "https://atomenta.com.br")!
|
||||
}
|
||||
|
||||
static var featureControlBffURL: URL {
|
||||
let raw = ProcessInfo.processInfo.environment["FEATURE_CONTROL_BFF_URL"] ?? "http://localhost:8787"
|
||||
return URL(string: raw) ?? URL(string: "http://localhost:8787")!
|
||||
}
|
||||
|
||||
static var featureControlEnvironment: String {
|
||||
let raw = ProcessInfo.processInfo.environment["FEATURE_CONTROL_ENVIRONMENT"] ?? "production"
|
||||
let clean = raw.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return clean.isEmpty ? "production" : clean
|
||||
}
|
||||
|
||||
// Tokens provided by backend modules
|
||||
static let storeToken = "550e8400-e29b-41d4-a716-446655440008"
|
||||
static let customerToken = "550e8400-e29b-41d4-a716-44665544000a"
|
||||
static let resourceToken = "550e8400-e29b-41d4-a716-446655440009"
|
||||
|
||||
static func token(for module: ApiModule) -> String? {
|
||||
switch module {
|
||||
case .store: return storeToken
|
||||
case .customer: return customerToken
|
||||
case .resource: return resourceToken
|
||||
case .app, .none: return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user