Merge pull request #13005 from gonzadelarge/devel

Get default options from meteor settings
This commit is contained in:
Nacho Codoñer
2024-04-17 12:06:29 -04:00
committed by GitHub
3 changed files with 40 additions and 2 deletions

View File

@@ -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`.
<h3 id="initialize-with-custom-settings">Initialize with custom settings</h3>
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
}
}
}
```

View File

@@ -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.

View File

@@ -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.