From bec1f5d7cf34533b0399b059c669728099d290dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Brito=20Brasil?= Date: Sun, 5 Feb 2023 11:00:40 -0300 Subject: [PATCH] fix: pass hosts to createCertificate function (#14) --- cli.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cli.js b/cli.js index 34c4179..4852122 100644 --- a/cli.js +++ b/cli.js @@ -1,10 +1,13 @@ #!/usr/bin/env node + import { existsSync } from 'fs'; + import { mkdir, writeFile } from 'fs/promises'; import minimist from 'minimist'; import pc from 'picocolors'; -import { DATA_DIR, resolvePath, readFile, pkgVersion } from './src/utils.js'; + import { createCertificate } from './src/index.js'; +import { DATA_DIR, pkgVersion, resolvePath } from './src/utils.js'; /** * Init, read variables and create folders @@ -93,12 +96,15 @@ if (!writeFiles) { } try { - const { cert, key } = await createCertificate({ - force, - autoUpgrade, - keyFilePath, - certFilePath, - }); + const { cert, key } = await createCertificate( + { + force, + autoUpgrade, + keyFilePath, + certFilePath, + }, + hosts + ); await writeFile(keyFilePath, key, { encoding: 'utf-8' }); await writeFile(certFilePath, cert, { encoding: 'utf-8' }); } catch (/** @type {any}*/ writeErr) {