From 9041b0f9adaa39b42bdd70fe5bc0fe5914b000bf Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Sun, 24 Nov 2024 08:01:24 -0500 Subject: [PATCH] chore: add info to log when audit, htpasswd, theme are used (#4956) * chore: add info to log when audit, htpasswd, theme are used * fix * fix * fix logger --- .changeset/gold-squids-watch.md | 8 ++++++++ packages/auth/src/auth.ts | 4 ++++ packages/server/express/src/server.ts | 14 ++++++++++---- packages/store/src/local-storage.ts | 4 ++-- packages/web/src/middleware.ts | 13 ++++++++++--- 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 .changeset/gold-squids-watch.md diff --git a/.changeset/gold-squids-watch.md b/.changeset/gold-squids-watch.md new file mode 100644 index 000000000..c952ff432 --- /dev/null +++ b/.changeset/gold-squids-watch.md @@ -0,0 +1,8 @@ +--- +'@verdaccio/server': patch +'@verdaccio/store': patch +'@verdaccio/auth': patch +'@verdaccio/web': patch +--- + +chore: add info to log when audit, htpasswd, theme are used diff --git a/packages/auth/src/auth.ts b/packages/auth/src/auth.ts index 47c6ffcbf..277206ffe 100644 --- a/packages/auth/src/auth.ts +++ b/packages/auth/src/auth.ts @@ -94,6 +94,10 @@ class Auth implements IAuthMiddleware, TokenEncryption, pluginUtils.IBasicAuth { { file: './htpasswd' }, pluginOptions as any as pluginUtils.PluginOptions ); + this.logger.info( + { name: 'verdaccio-htpasswd', pluginCategory: PLUGIN_CATEGORY.AUTHENTICATION }, + 'plugin @{name} successfully loaded (@{pluginCategory})' + ); } catch (error: any) { debug('error on loading auth htpasswd plugin stack: %o', error); this.logger.info({}, 'no auth plugin has been found'); diff --git a/packages/server/express/src/server.ts b/packages/server/express/src/server.ts index b96f68de7..848754444 100644 --- a/packages/server/express/src/server.ts +++ b/packages/server/express/src/server.ts @@ -78,9 +78,15 @@ const defineAPI = async function (config: IConfig, storage: Storage): Promise) => { @@ -97,7 +103,7 @@ const defineAPI = async function (config: IConfig, storage: Storage): Promise 1) { - logger.warn('multiple ui themes are not supported , only the first plugin is used used'); + logger.warn('multiple ui themes are not supported; only the first plugin is used'); } return _.head(plugin); } } -export default async (config, auth, storage) => { - const pluginOptions = (await loadTheme(config)) || require('@verdaccio/ui-theme')(config.web); +export default async (config, auth, storage, logger) => { + let pluginOptions = await loadTheme(config); + if (!pluginOptions) { + pluginOptions = require('@verdaccio/ui-theme')(config.web); + logger.info( + { name: '@verdaccio/ui-theme', pluginCategory: PLUGIN_CATEGORY.THEME }, + 'plugin @{name} successfully loaded (@{pluginCategory})' + ); + } // eslint-disable-next-line new-cap const router = express.Router();