meteor__authdemo/docs/service-configuration/README.md

63 lines
2 KiB
Markdown

# service-configuration package
## Files documented
* `service_configuration_common.js`: defines the collection publish and a `ServiceConfiguration.ConfigError` error class.
* `service_configuration_server.hs`: ensures the index on the service collection.
## Architecture
This package just provides access to a configuration collection in `ServiceConfiguration.configurations`. Packages using the configuration are expected to use Mongo queries on that collection, find-ing using `{ service: service_name }`.
All properties of that collection are published client-side, except `secret` which is only available server-side.
Configuration is inserted by the `AccountsServer.configureLoginService(options)` method from `accounts-base`. In Meteor core, this method is used by `login_buttons_dialogs.js` like:
Accounts.connection.call("configureLoginService", configuration, function (error, result) {
if (error)
Meteor._debug("Error configuring login service " + serviceName, error);
else
loginButtonsSession.set('configureLoginServiceDialogVisible', false);
}
);
## Collections
* `meteor_accounts_loginServiceConfiguration`
* Index: `{ "service": 1 }, { unique: true }`
The service-configuration package persists configuration in the `meteor_accounts_loginServiceConfiguration` collection in MongoDB. As each service should have exactly one configuration, Meteor automatically creates a MongoDB index with a unique constraint on the `meteor_accounts_loginServiceConfiguration` collection.
## Constants
None
## Classes
None
## Functions
None
## Dependencies / Exports (`package.js` _et al._)
### Exports
| Symbol | Client | Server | Test |
|----------------------|:------:|:------:|:----:|
| ServiceConfiguration | O | O | O |
Silently used (without a declared dependency) in `accounts-base`.
### Dependencies
* uses `accounts-base`
* uses `mongo`
## Package-local variables
* None
## Side-effects
* Ensures the index on the service configuration collection upon launch.