mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +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" : "");
|
let modelPath = path.resolve(options.model) + (!!options.model && !path.extname(options.model) ? ".pass" : "");
|
||||||
const filteredOpts = schema.getValidated(options.overrides, "supportedOptions");
|
const filteredOpts = schema.getValidated(options.overrides, "supportedOptions");
|
||||||
|
|
||||||
if (!Object.keys(filteredOpts).length) {
|
if (!filteredOpts) {
|
||||||
throw new Error(formatMessage("OVV_KEYS_BADFORMAT"))
|
throw new Error(formatMessage("OVV_KEYS_BADFORMAT"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,10 +714,16 @@ function readCertificates(certificates) {
|
|||||||
const optCertsNames = Object.keys(raw);
|
const optCertsNames = Object.keys(raw);
|
||||||
const certPaths = optCertsNames.map((val) => {
|
const certPaths = optCertsNames.map((val) => {
|
||||||
const cert = raw[val];
|
const cert = raw[val];
|
||||||
const filePath = !(cert instanceof Object) ? cert : cert["keyFile"];
|
// realRawValue exists as signerKey might be an object
|
||||||
const resolvedPath = path.resolve(filePath);
|
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)
|
return Promise.all(certPaths)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ function getValidated(opts, schemaName) {
|
|||||||
|
|
||||||
if (validation.error) {
|
if (validation.error) {
|
||||||
debug(`Validation failed in getValidated due to error: ${validation.error.message}`);
|
debug(`Validation failed in getValidated due to error: ${validation.error.message}`);
|
||||||
return {};
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return validation.value;
|
return validation.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user