swift-apple-intelligence-grpc/Sources/AppleIntelligenceCore/Config.swift
Mathias Beaulieu-Duncan e0bf17da3d Add macOS menu bar app with chat and settings
- Restructure project into three targets:
  - AppleIntelligenceCore: Shared gRPC service code
  - AppleIntelligenceServer: CLI server
  - AppleIntelligenceApp: Menu bar app

- Menu bar app features:
  - Toggle server on/off from menu bar
  - Chat window with streaming AI responses
  - Settings: host, port, API key, auto-start, launch at login
  - Proper window focus handling for menu bar apps

- Add build scripts for distribution:
  - build-app.sh: Creates signed .app bundle
  - create-dmg.sh: Creates distributable DMG

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 04:31:31 -05:00

28 lines
911 B
Swift

import Foundation
/// Server configuration loaded from environment variables
public struct Config: Sendable {
/// Host to bind the server to (default: 0.0.0.0 for LAN access)
public let host: String
/// Port to listen on (default: 50051)
public let port: Int
/// Optional API key for authentication via gRPC metadata
public let apiKey: String?
/// Initialize configuration from environment variables
public init() {
self.host = ProcessInfo.processInfo.environment["GRPC_HOST"] ?? "0.0.0.0"
self.port = Int(ProcessInfo.processInfo.environment["GRPC_PORT"] ?? "50051") ?? 50051
self.apiKey = ProcessInfo.processInfo.environment["API_KEY"]
}
/// Initialize with explicit values (for testing)
public init(host: String, port: Int, apiKey: String? = nil) {
self.host = host
self.port = port
self.apiKey = apiKey
}
}