mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 14:25:17 +00:00
Added content-certificates support;
Fixed problem with supported options
This commit is contained in:
14
src/pass.js
14
src/pass.js
@@ -671,7 +671,7 @@ class Pass {
|
||||
let modelPath = path.resolve(options.model) + (!!options.model && !path.extname(options.model) ? ".pass" : "");
|
||||
const filteredOpts = schema.getValidated(options.overrides, "supportedOptions");
|
||||
|
||||
if (!Object.keys(filteredOpts).length) {
|
||||
if (!filteredOpts) {
|
||||
throw new Error(formatMessage("OVV_KEYS_BADFORMAT"))
|
||||
}
|
||||
|
||||
@@ -714,10 +714,16 @@ function readCertificates(certificates) {
|
||||
const optCertsNames = Object.keys(raw);
|
||||
const certPaths = optCertsNames.map((val) => {
|
||||
const cert = raw[val];
|
||||
const filePath = !(cert instanceof Object) ? cert : cert["keyFile"];
|
||||
const resolvedPath = path.resolve(filePath);
|
||||
// realRawValue exists as signerKey might be an object
|
||||
const realRawValue = !(cert instanceof Object) ? cert : cert["keyFile"];
|
||||
|
||||
return readFile(resolvedPath);
|
||||
// We are checking if the string is a path or a content
|
||||
if (!!path.parse(realRawValue).ext) {
|
||||
const resolvedPath = path.resolve(realRawValue);
|
||||
return readFile(resolvedPath);
|
||||
} else {
|
||||
return Promise.resolve(realRawValue);
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all(certPaths)
|
||||
|
||||
@@ -146,7 +146,7 @@ function getValidated(opts, schemaName) {
|
||||
|
||||
if (validation.error) {
|
||||
debug(`Validation failed in getValidated due to error: ${validation.error.message}`);
|
||||
return {};
|
||||
return null;
|
||||
}
|
||||
|
||||
return validation.value;
|
||||
|
||||
Reference in New Issue
Block a user