Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portfolio 29267 test #82

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ let package = Package(
"DictionaryCoder",
"FigmaGenTools",
"Expression",
"KeychainAccess"
.product(
name: "KeychainAccess",
package: "KeychainAccess",
condition: .when(platforms: [.macOS])
)
],
path: "Sources/FigmaGen"
),
Expand All @@ -45,8 +49,7 @@ let package = Package(
dependencies: [
"SwiftCLI",
"PathKit",
"PromiseKit",
"KeychainAccess"
"PromiseKit"
],
path: "Sources/FigmaGenTools"
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Foundation
#if !os(Linux)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может лучше if os(macOS)? Вроде только для него должно работать

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 !os(Linux)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут аналогично, получается

let accessToken = try? Keychain(service: parameters.service).getString(parameters.key)
return accessToken
#else
return nil
#endif
} else {
return nil
}
Expand Down
Loading