Skip to content

Commit

Permalink
add if
Browse files Browse the repository at this point in the history
  • Loading branch information
VDA22 committed May 17, 2024
1 parent 2d67a0a commit bfdb2ea
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Foundation
#if canImport(FigmaGen)
import KeychainAccess
#endif

final class DefaultAccessTokenResolver: AccessTokenResolver {

Expand All @@ -9,9 +11,13 @@ final class DefaultAccessTokenResolver: AccessTokenResolver {
} else if let environmentVariable = configuration?.environmentVariable,
let accessToken = ProcessInfo.processInfo.environment[environmentVariable] {
return accessToken
} else if let parameters = configuration?.keychainParameters,
let accessToken = try? Keychain(service: parameters.service).getString(parameters.key) {
} else if let parameters = configuration?.keychainParameters {
#if canImport(FigmaGen)
let accessToken = try? Keychain(service: parameters.service).getString(parameters.key)
return accessToken
#else
return nil
#endif
} else {
return nil
}
Expand Down

0 comments on commit bfdb2ea

Please sign in to comment.