Skip to content

Commit c1fbb4a

Browse files
committed
packager: codesign: macos: Fix certificates
Currently, it is not possible to pass signing_certificate and signing_certificate_password using Cargo.toml of config json. Instead, from what I gather, environment variables should be used for these variables. However, the current logic to fallback to environment variables is erroneous and will only use environment variables if no macos property is defined, as opposed to if the variable is not found in the config. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
1 parent c34de36 commit c1fbb4a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/packager/src/codesign/macos.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ impl PartialOrd for SignTarget {
171171
pub fn try_sign(targets: Vec<SignTarget>, identity: &str, config: &Config) -> crate::Result<()> {
172172
let certificate_encoded = config
173173
.macos()
174-
.map(|m| m.signing_certificate.clone())
175-
.unwrap_or_else(|| std::env::var_os("APPLE_CERTIFICATE"));
174+
.and_then(|m| m.signing_certificate.clone())
175+
.or_else(|| std::env::var_os("APPLE_CERTIFICATE"));
176176

177177
let certificate_password = config
178178
.macos()
179-
.map(|m| m.signing_certificate_password.clone())
180-
.unwrap_or_else(|| std::env::var_os("APPLE_CERTIFICATE_PASSWORD"));
179+
.and_then(|m| m.signing_certificate_password.clone())
180+
.or_else(|| std::env::var_os("APPLE_CERTIFICATE_PASSWORD"));
181181

182182
let packager_keychain = if let (Some(certificate_encoded), Some(certificate_password)) =
183183
(certificate_encoded, certificate_password)

0 commit comments

Comments
 (0)