-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
46 lines (43 loc) · 1.54 KB
/
config.go
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
package driver
import (
"github.com/Drafteame/mgorepo/internal/env"
)
// Config is the configuration for the driver.
type Config struct {
SSLVerifyCertificate bool
ConnectTimeout int
QueryTimeout int
MinPoolSize int
MaxPoolSize int
URI string
ReadPreference string
RetryWrites string
AuthSource string
AuthMechanism string
ReplicaSet string
Username string
Password string
ClusterEndpoint string
CertPath string
DBName string
}
func DefaultConfig() Config {
return Config{
SSLVerifyCertificate: env.GetBool(MongoSSLVerifyEnv),
ConnectTimeout: env.GetInt(MongoConnectTimeoutEnv),
QueryTimeout: env.GetInt(MongoQueryTimeoutEnv),
URI: env.GetString(MongoURIEnv),
ReadPreference: env.GetString(MongoReadPreferenceEnv),
RetryWrites: env.GetString(MongoRetryWritesEnv),
AuthSource: env.GetString(MongoAuthSourceEnv),
AuthMechanism: env.GetString(MongoAuthMechanismEnv),
ReplicaSet: env.GetString(MongoReplicaSetEnv),
Username: env.GetString(MongoUsernameEnv),
Password: env.GetString(MongoPasswordEnv),
ClusterEndpoint: env.GetString(MongoClusterEndpointEnv),
CertPath: env.GetString(MongoCertPathEnv),
DBName: env.GetString(MongoDBNameEnv),
MinPoolSize: env.GetInt(MongoMinPoolSizeEnv),
MaxPoolSize: env.GetInt(MongoMaxPoolSizeEnv),
}
}