mirror of
https://github.com/PretendoNetwork/SSSL.git
synced 2026-04-26 02:18:02 -05:00
chore: set environment variables from option names
This commit is contained in:
parent
9340afd844
commit
6fc3580331
23
patch.js
23
patch.js
|
|
@ -18,44 +18,37 @@ const optionsConfig = {
|
||||||
nintendo_ca_g3_path: {
|
nintendo_ca_g3_path: {
|
||||||
shortOption: 'g3',
|
shortOption: 'g3',
|
||||||
default: './CACERT_NINTENDO_CA_G3.der',
|
default: './CACERT_NINTENDO_CA_G3.der',
|
||||||
description: 'Path to Nintendo CA - G3 certificate (may be in DER or PEM format, default to this directory)',
|
description: 'Path to Nintendo CA - G3 certificate (may be in DER or PEM format, default to this directory)'
|
||||||
env: 'SSSL_NINTENDO_CA_G3_PATH'
|
|
||||||
},
|
},
|
||||||
nintendo_ca_g3_format: {
|
nintendo_ca_g3_format: {
|
||||||
shortOption: 'f',
|
shortOption: 'f',
|
||||||
default: 'der',
|
default: 'der',
|
||||||
description: 'Nintendo CA - G3 certificate format (must be "der" or "pem")',
|
description: 'Nintendo CA - G3 certificate format (must be "der" or "pem")'
|
||||||
env: 'SSSL_NINTENDO_CA_G3_FORMAT'
|
|
||||||
},
|
},
|
||||||
ca_private_key_path: {
|
ca_private_key_path: {
|
||||||
shortOption: 'cap',
|
shortOption: 'cap',
|
||||||
default: undefined,
|
default: undefined,
|
||||||
description: 'Path to private key for forged CA (will generate if not set)',
|
description: 'Path to private key for forged CA (will generate if not set)'
|
||||||
env: 'SSSL_CA_PRIVATE_KEY_PATH'
|
|
||||||
},
|
},
|
||||||
site_private_key_path: {
|
site_private_key_path: {
|
||||||
shortOption: 'sp',
|
shortOption: 'sp',
|
||||||
default: undefined,
|
default: undefined,
|
||||||
description: 'Path to private key for site certificate (will generate if not set)',
|
description: 'Path to private key for site certificate (will generate if not set)'
|
||||||
env: 'SSSL_SITE_PRIVATE_KEY_PATH'
|
|
||||||
},
|
},
|
||||||
csr_path: {
|
csr_path: {
|
||||||
shortOption: 'csrp',
|
shortOption: 'csrp',
|
||||||
default: undefined,
|
default: undefined,
|
||||||
description: 'Path to CSR (will generate if not set)',
|
description: 'Path to CSR (will generate if not set)'
|
||||||
env: 'SSSL_CSR_PATH'
|
|
||||||
},
|
},
|
||||||
common_name: {
|
common_name: {
|
||||||
shortOption: 'cn',
|
shortOption: 'cn',
|
||||||
default: '*',
|
default: '*',
|
||||||
description: 'CN for site certificate (default to "*")',
|
description: 'CN for site certificate (default to "*")'
|
||||||
env: 'SSSL_COMMON_NAME'
|
|
||||||
},
|
},
|
||||||
output_folder_path: {
|
output_folder_path: {
|
||||||
shortOption: 'o',
|
shortOption: 'o',
|
||||||
default: './',
|
default: './',
|
||||||
description: 'Output folder (default to this directory)',
|
description: 'Output folder (default to this directory)'
|
||||||
env: 'SSSL_OUTPUT_FOLDER_PATH'
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -78,7 +71,7 @@ async function main() {
|
||||||
|
|
||||||
const options = {};
|
const options = {};
|
||||||
for (const [option, config] of Object.entries(optionsConfig)) {
|
for (const [option, config] of Object.entries(optionsConfig)) {
|
||||||
options[option] = commandOptions[option] || process.env[config.env] || config.default;
|
options[option] = commandOptions[option] || process.env['SSSL_' + option.toUpperCase()] || config.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateOptions(options)) {
|
if (validateOptions(options)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user