Merge branch 'infrastructure-not-remembered'
This commit is contained in:
commit
c6f154ec18
|
@ -106,7 +106,12 @@ public class InfrastructureFactory {
|
|||
guard let data = try? Data(contentsOf: entry) else {
|
||||
continue
|
||||
}
|
||||
guard let infra = try? decoder.decode(Infrastructure.self, from: data) else {
|
||||
let infra: Infrastructure
|
||||
do {
|
||||
infra = try decoder.decode(Infrastructure.self, from: data)
|
||||
} catch let e {
|
||||
log.warning("Unable to load infrastructure \(entry.lastPathComponent): \(e)")
|
||||
log.warning("\(String(data: data, encoding: .utf8)!)")
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,13 @@ public struct InfrastructurePreset: Codable {
|
|||
try container.encode(id, forKey: .id)
|
||||
try container.encode(name, forKey: .name)
|
||||
try container.encode(comment, forKey: .comment)
|
||||
try container.encodeIfPresent(external, forKey: .external)
|
||||
if let external = external {
|
||||
var rawExternal: [String: String] = [:]
|
||||
for entry in external {
|
||||
rawExternal[entry.key.rawValue] = entry.value
|
||||
}
|
||||
try container.encodeIfPresent(rawExternal, forKey: .external)
|
||||
}
|
||||
|
||||
var cfgContainer = container.nestedContainer(keyedBy: ConfigurationKeys.self, forKey: .configuration)
|
||||
try cfgContainer.encode(configuration.sessionConfiguration.cipher, forKey: .cipher)
|
||||
|
|
Loading…
Reference in New Issue