diff --git a/docs/source/api/accounts.md b/docs/source/api/accounts.md index cf0cb7205a..86c5550cec 100644 --- a/docs/source/api/accounts.md +++ b/docs/source/api/accounts.md @@ -338,3 +338,41 @@ Accounts.ui.config({ Since Meteor 2.7 you can configure these in your Meteor settings under `Meteor.settings.public.packages.accounts-ui-unstyled`. + +

Initialize with custom settings

+ +This feature allows users to specify custom configuration parameters for both client-side and server-side initialization. + +* Client + +{% apibox "AccountsClient" %} + +On the client-side, AccountsClient can be initialized with custom parameters provided through Meteor settings configuration. Below is an example of how to use this functionality: + +```json +{ + "public": { + "packages": { + "accounts": { + ...configParams + } + } + } +} +``` + +* Server + +{% apibox "AccountsServer" %} + +On the server-side, AccountsServer can also be initialized with custom parameters. Server-specific configuration may differ from the client and can also be specified through Meteor settings. Below is an example of how to do it: + +```json +{ + "packages": { + "accounts": { + ...configParams + } + } +} +``` \ No newline at end of file diff --git a/packages/accounts-base/client_main.js b/packages/accounts-base/client_main.js index b3022e862a..09a9cf84f9 100644 --- a/packages/accounts-base/client_main.js +++ b/packages/accounts-base/client_main.js @@ -7,7 +7,7 @@ import { * @namespace Accounts * @summary The namespace for all client-side accounts-related methods. */ -Accounts = new AccountsClient(); +Accounts = new AccountsClient(Meteor.settings?.public?.packages?.accounts || {}); /** * @summary A [Mongo.Collection](#collections) containing user documents. diff --git a/packages/accounts-base/server_main.js b/packages/accounts-base/server_main.js index db5020fed5..953f4f3d10 100644 --- a/packages/accounts-base/server_main.js +++ b/packages/accounts-base/server_main.js @@ -4,7 +4,7 @@ import { AccountsServer } from "./accounts_server.js"; * @namespace Accounts * @summary The namespace for all server-side accounts-related methods. */ -Accounts = new AccountsServer(Meteor.server); +Accounts = new AccountsServer(Meteor.server, Meteor.settings.packages?.accounts || {}); // Users table. Don't use the normal autopublish, since we want to hide // some fields. Code to autopublish this is in accounts_server.js.