-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.js
85 lines (80 loc) · 3.08 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*!
* Copyright 2012 - 2024 Digital Bazaar, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
import {config} from '@bedrock/core';
config.mongodb = {};
// Note: `config.mongodb.url` is not set by default. When it is not set, it
// will be assembled from from the `config.mongodb.name`, `config.mongodb.host`,
// and `config.mongodb.port`. When it is set, those values, any authentication
// credentials, and any server options will be parsed from the URL and override
// the broken-down configuration options set here.
//
// At a minimum, the URL must specify a host, port, and database name. It may
// omit a username and password if those are provided as
// `config.mongodb.username` and `config.mongodb.password`, otherwise those
// values will be removed from the URL to prevent their logging and a
// separate authentication call will be made after connecting.
//
// `mongodb.connectOptions` will override any specified in the URL.
//
// format: mongodb://[username:password@]host1[:port1][,host2[:port2],
// ...[,hostN[:portN]]][/[database][?options]]
//
// config.mongodb.url = 'mongodb://localhost:27017/bedrock_dev';
config.mongodb.name = 'bedrock_dev';
config.mongodb.host = 'localhost';
config.mongodb.port = 27017;
config.mongodb.protocol = 'mongodb';
config.mongodb.username = undefined;
config.mongodb.password = undefined;
config.mongodb.adminPrompt = true;
// always authenticate to mongodb even when auth is not required by mongodb
config.mongodb.forceAuthentication = false;
config.mongodb.authentication = {
// used by MongoDB >= 3.0
// authMechanism: 'SCRAM-SHA-1'
// used by MongoDB < 3.0
// authMechanism: 'MONGODB-CR'
};
// this is used when making connections to the database
config.mongodb.connectOptions = {
useUnifiedTopology: true,
serverSelectionTimeoutMS: 30000,
autoReconnect: false,
useNewUrlParser: true,
// promotes binary BSON values to native Node.js buffers
promoteBuffers: true,
// it is recommended to set either ssl or tls to true in production
// ssl: true
// tls: true
// authSource is the database you authenticate against
// it often needs to be set explicitly
// authSource: 'admin'
};
// this is used when writing to the database
config.mongodb.writeOptions = {
writeConcern: {
w: 'majority',
j: true,
},
forceServerObjectId: true,
};
config.mongodb.requirements = {};
// server version requirement with server-style string
config.mongodb.requirements.serverVersion = '>=4.2';
// this is used by _createUser to add a user as an admin to a collection
// config.mongodb.collection = 'admin-collection';