This repository was archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathDecodeUserConfiguration.swift
65 lines (61 loc) · 2.49 KB
/
DecodeUserConfiguration.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// DecodeUserConfiguration.swift
// RsyncUI
//
// Created by Thomas Evensen on 12/02/2022.
//
import Foundation
struct DecodeUserConfiguration: Codable {
let rsyncversion3: Int?
// Detailed logging
let detailedlogging: Int?
// Logging to logfile
let minimumlogging: Int?
let fulllogging: Int?
// let nologging: Int?
// Monitor network connection
let monitornetworkconnection: Int?
// local path for rsync
let localrsyncpath: String?
// temporary path for restore
let pathforrestore: String?
// days for mark days since last synchronize
let marknumberofdayssince: String?
// Global ssh keypath and port
let sshkeypathandidentityfile: String?
let sshport: Int?
// Environment variable
let environment: String?
let environmentvalue: String?
enum CodingKeys: String, CodingKey {
case rsyncversion3
case detailedlogging
case minimumlogging
case fulllogging
// case nologging
case monitornetworkconnection
case localrsyncpath
case pathforrestore
case marknumberofdayssince
case sshkeypathandidentityfile
case sshport
case environment
case environmentvalue
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
rsyncversion3 = try values.decodeIfPresent(Int.self, forKey: .rsyncversion3)
detailedlogging = try values.decodeIfPresent(Int.self, forKey: .detailedlogging)
minimumlogging = try values.decodeIfPresent(Int.self, forKey: .minimumlogging)
fulllogging = try values.decodeIfPresent(Int.self, forKey: .fulllogging)
// nologging = try values.decodeIfPresent(Int.self, forKey: .nologging)
monitornetworkconnection = try values.decodeIfPresent(Int.self, forKey: .monitornetworkconnection)
localrsyncpath = try values.decodeIfPresent(String.self, forKey: .localrsyncpath)
pathforrestore = try values.decodeIfPresent(String.self, forKey: .pathforrestore)
marknumberofdayssince = try values.decodeIfPresent(String.self, forKey: .marknumberofdayssince)
sshkeypathandidentityfile = try values.decodeIfPresent(String.self, forKey: .sshkeypathandidentityfile)
sshport = try values.decodeIfPresent(Int.self, forKey: .sshport)
environment = try values.decodeIfPresent(String.self, forKey: .environment)
environmentvalue = try values.decodeIfPresent(String.self, forKey: .environmentvalue)
}
}