Environment Configuration
Relevant source files
The following files were used as context for generating this wiki page:
The environment configuration for the Social-Connect application defines the foundational settings required for network communication, authentication state management, and external integration. This system ensures that the application can securely interact with remote services and respond to system-level events such as deep link activations.
The configuration is primarily distributed across specialized managers that handle the base API routing, secure storage of credentials, and the initialization of routing logic during the application lifecycle.
Networking and Base Infrastructure
The core of the environment configuration resides within the APIClient, which defines the network boundary for the application. It centralizes the connection settings used by all service-level modules.
Base URL and Session Management
The application is configured to communicate with a specific API versioning scheme. It utilizes a shared URLSession for managing network tasks.
- Base URL:
https://api.socialconnect.com/v1/ - Content Type:
application/json
Sources: APIClient.swift:4-5, APIClient.swift:15
Security Configuration
Authentication is handled by injecting a Bearer token into the Authorization header of outgoing requests. This token is retrieved from the secure environment provided by the iOS Keychain.
The diagram shows the logic flow for injecting environment-specific authentication credentials into network requests.
Sources: APIClient.swift:18-21, KeychainManager.swift:10-24
Authentication Environment
The environment relies on KeychainManager to interface with the system's secure storage. This ensures that sensitive configuration data, like the authToken, persists across application launches and remains isolated from the standard filesystem.
| Key | Type | Storage | Description |
|---|---|---|---|
authToken | String | Keychain (kSecClassGenericPassword) | The primary credential for authenticated API requests. |
Sources: KeychainManager.swift:10-14
Application Entry and Routing
The AppDelegate serves as the entry point where the environment is initialized and external triggers are caught. Specifically, it configures the DeepLinkHandler to manage incoming URLs.
Deep Link Configuration
The environment supports several host-based routes that allow external URLs to trigger internal logic.
This flowchart illustrates how the environment routes external URL components to specific internal service calls.
Sources: DeepLinkHandler.swift:9-25, AppDelegate.swift:15-18
Integration Parameters
The following table summarizes the deep link parameters supported by the environment:
| Host | Parameter | Action |
|---|---|---|
profile | userId | Navigates to a specific user profile. |
follow | userId | Initiates a follow request via UserService. |
Sources: DeepLinkHandler.swift:28-43
Service Layer Configuration
The UserService acts as an intermediary, configuring specific endpoints based on the base environment settings provided by APIClient. It maps high-level application actions to specific URI paths.
- Follow Endpoint:
users/{userId}/follow - Unfollow Endpoint:
users/{userId}/unfollow
Upon successful interaction with these endpoints, the environment triggers a notification (.userFollowStatusChanged) to update the local application state.
Sources: UserService.swift:8-11, UserService.swift:20-23
Summary
Environment configuration in Social-Connect is managed through a combination of hardcoded base network parameters in the APIClient, secure credential retrieval from KeychainManager, and dynamic routing configuration in DeepLinkHandler. This structured approach ensures that the application maintains a consistent and secure connection to its backend services while responding correctly to external system events.