mirror of
https://github.com/PretendoNetwork/SSSL.git
synced 2026-03-21 17:34:48 -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: {
|
||||
shortOption: 'g3',
|
||||
default: './CACERT_NINTENDO_CA_G3.der',
|
||||
description: 'Path to Nintendo CA - G3 certificate (may be in DER or PEM format, default to this directory)',
|
||||
env: 'SSSL_NINTENDO_CA_G3_PATH'
|
||||
description: 'Path to Nintendo CA - G3 certificate (may be in DER or PEM format, default to this directory)'
|
||||
},
|
||||
nintendo_ca_g3_format: {
|
||||
shortOption: 'f',
|
||||
default: 'der',
|
||||
description: 'Nintendo CA - G3 certificate format (must be "der" or "pem")',
|
||||
env: 'SSSL_NINTENDO_CA_G3_FORMAT'
|
||||
description: 'Nintendo CA - G3 certificate format (must be "der" or "pem")'
|
||||
},
|
||||
ca_private_key_path: {
|
||||
shortOption: 'cap',
|
||||
default: undefined,
|
||||
description: 'Path to private key for forged CA (will generate if not set)',
|
||||
env: 'SSSL_CA_PRIVATE_KEY_PATH'
|
||||
description: 'Path to private key for forged CA (will generate if not set)'
|
||||
},
|
||||
site_private_key_path: {
|
||||
shortOption: 'sp',
|
||||
default: undefined,
|
||||
description: 'Path to private key for site certificate (will generate if not set)',
|
||||
env: 'SSSL_SITE_PRIVATE_KEY_PATH'
|
||||
description: 'Path to private key for site certificate (will generate if not set)'
|
||||
},
|
||||
csr_path: {
|
||||
shortOption: 'csrp',
|
||||
default: undefined,
|
||||
description: 'Path to CSR (will generate if not set)',
|
||||
env: 'SSSL_CSR_PATH'
|
||||
description: 'Path to CSR (will generate if not set)'
|
||||
},
|
||||
common_name: {
|
||||
shortOption: 'cn',
|
||||
default: '*',
|
||||
description: 'CN for site certificate (default to "*")',
|
||||
env: 'SSSL_COMMON_NAME'
|
||||
description: 'CN for site certificate (default to "*")'
|
||||
},
|
||||
output_folder_path: {
|
||||
shortOption: 'o',
|
||||
default: './',
|
||||
description: 'Output folder (default to this directory)',
|
||||
env: 'SSSL_OUTPUT_FOLDER_PATH'
|
||||
description: 'Output folder (default to this directory)'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -78,7 +71,7 @@ async function main() {
|
|||
|
||||
const options = {};
|
||||
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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user