Skip to content

Commit bcab222

Browse files
committed
fix: refactor get version
1 parent 1e48416 commit bcab222

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

Sources/FSAppConfiguration/FSAppConfiguration.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,7 @@ public struct FSAppConfiguration {
7171
/// - name: `String`the name of the Version file that lies in the local directory
7272
/// - Returns: `String` Version value
7373
public func getVersion(with consulStatus: HTTPResponseStatus?, by url: String, and path: String, file name: String) -> String {
74-
let consulURI = URI(string: url + "/" + path)
75-
var versionValue = ""
76-
77-
if consulStatus == .ok {
78-
let valueResult = try? getVersionFromConsul(by: consulURI).wait()
79-
versionValue = valueResult ?? ""
80-
}
81-
return versionValue.isEmpty ? self.getVersionFromLocalDirectory(by: name) : versionValue
74+
self.getVersionFromLocalDirectory(by: name)
8275
}
8376

8477
/// Get value from Consul

Sources/FSAppConfiguration/FSAppConfigurationAsync.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,7 @@ public struct FSAppConfigurationAsync {
7171
/// - name: `String`the name of the Version file that lies in the local directory
7272
/// - Returns: `String` Version value
7373
public func getVersion(with consulStatus: HTTPResponseStatus?, by url: String, and path: String, file name: String) async -> String {
74-
let consulURI = URI(string: url + "/" + path)
75-
var versionValue = ""
76-
77-
if consulStatus == .ok {
78-
let valueResult = try? await getVersionFromConsul(by: consulURI)
79-
versionValue = valueResult ?? ""
80-
}
81-
return versionValue.isEmpty ? self.getVersionFromLocalDirectory(by: name) : versionValue
74+
self.getVersionFromLocalDirectory(by: name)
8275
}
8376

8477
/// Get value from Consul

0 commit comments

Comments
 (0)