feat: support configurable gateway port

This commit is contained in:
Peter Steinberger
2026-01-03 12:00:17 +01:00
parent 7199813969
commit f47c7ac369
23 changed files with 172 additions and 46 deletions

View File

@@ -106,4 +106,20 @@ enum ClawdisConfigFile {
return remote["password"] as? String
}
static func gatewayPort() -> Int? {
let root = self.loadDict()
guard let gateway = root["gateway"] as? [String: Any] else { return nil }
if let port = gateway["port"] as? Int, port > 0 { return port }
if let number = gateway["port"] as? NSNumber, number.intValue > 0 {
return number.intValue
}
if let raw = gateway["port"] as? String,
let parsed = Int(raw.trimmingCharacters(in: .whitespacesAndNewlines)),
parsed > 0
{
return parsed
}
return nil
}
}