MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / DefaultDbConfig

Function DefaultDbConfig

rest/config_database.go:125–209  ·  view source on GitHub ↗

DefaultDbConfig provides a DbConfig with all the default values populated. Used with MergeDatabaseConfigWithDefaults to provide defaults to include_runtime config endpoints. Note that this does not include unsupported options

(sc *StartupConfig, useXattrs bool)

Source from the content-addressed store, hash-verified

123// to provide defaults to include_runtime config endpoints.
124// Note that this does not include unsupported options
125func DefaultDbConfig(sc *StartupConfig, useXattrs bool) *DbConfig {
126 dbConfig := DbConfig{
127 BucketConfig: BucketConfig{},
128 Name: "",
129 Sync: base.Ptr(channels.DocChannelsSyncFunction),
130 Users: nil,
131 Roles: nil,
132 RevsLimit: nil, // Set this below struct
133 ImportFilter: nil,
134 ImportBackupOldRev: base.Ptr(false),
135 EventHandlers: nil,
136 FeedType: "",
137 AllowEmptyPassword: base.Ptr(false),
138 CacheConfig: &CacheConfig{
139 RevCacheConfig: &RevCacheConfig{
140 MaxItemCount: base.Ptr(db.DefaultRevisionCacheSize),
141 ShardCount: base.Ptr(db.DefaultRevisionCacheShardCount),
142 },
143 ChannelCacheConfig: &ChannelCacheConfig{
144 MaxNumber: base.Ptr(db.DefaultChannelCacheMaxNumber),
145 HighWatermarkPercent: base.Ptr(db.DefaultCompactHighWatermarkPercent),
146 LowWatermarkPercent: base.Ptr(db.DefaultCompactLowWatermarkPercent),
147 MaxWaitPending: base.Ptr(uint32(db.DefaultCachePendingSeqMaxWait.Milliseconds())),
148 MaxNumPending: base.Ptr(db.DefaultCachePendingSeqMaxNum),
149 MaxWaitSkipped: base.Ptr(uint32(db.DefaultSkippedSeqMaxWait.Milliseconds())),
150 EnableStarChannel: base.Ptr(true),
151 MaxLength: base.Ptr(db.DefaultChannelCacheMaxLength),
152 MinLength: base.Ptr(db.DefaultChannelCacheMinLength),
153 ExpirySeconds: base.Ptr(int(db.DefaultChannelCacheAge.Seconds())),
154 },
155 },
156 StartOffline: base.Ptr(false),
157 OIDCConfig: nil,
158 OldRevExpirySeconds: base.Ptr(base.DefaultOldRevExpirySeconds),
159 ViewQueryTimeoutSecs: base.Ptr(uint32(base.DefaultViewTimeout.Seconds())),
160 LocalDocExpirySecs: base.Ptr(base.DefaultLocalDocExpirySecs),
161 EnableXattrs: base.Ptr(base.DefaultUseXattrs),
162 SecureCookieOverride: base.Ptr(sc.API.HTTPS.TLSCertPath != ""),
163 SessionCookieName: "",
164 SessionCookieHTTPOnly: base.Ptr(false),
165 AllowConflicts: base.Ptr(base.DefaultAllowConflicts),
166 Index: &IndexConfig{
167 NumReplicas: base.Ptr(DefaultNumIndexReplicas),
168 },
169 UseViews: base.Ptr(false),
170 SendWWWAuthenticateHeader: base.Ptr(true),
171 BucketOpTimeoutMs: nil,
172 SlowQueryWarningThresholdMs: base.Ptr(kDefaultSlowQueryWarningThreshold),
173 DeltaSync: &DeltaSyncConfig{
174 Enabled: base.Ptr(db.DefaultDeltaSyncEnabled),
175 RevMaxAgeSeconds: base.Ptr(db.DefaultDeltaSyncRevMaxAge),
176 },
177 StoreLegacyRevTreeData: base.Ptr(db.DefaultStoreLegacyRevTreeData),
178 CompactIntervalDays: base.Ptr(float32(db.DefaultCompactInterval.Hours() / 24)),
179 SGReplicateEnabled: base.Ptr(db.DefaultSGReplicateEnabled),
180 SGReplicateWebsocketPingInterval: base.Ptr(int(db.DefaultSGReplicateWebsocketPingInterval.Seconds())),
181 Replications: nil,
182 ServeInsecureAttachmentTypes: base.Ptr(false),

Callers 3

TestDefaultDbConfigFunction · 0.85

Calls 5

PtrFunction · 0.92
IsEnterpriseEditionFunction · 0.92
DefaultPerDBLoggingFunction · 0.85
IsServerlessMethod · 0.80

Tested by 2

TestDefaultDbConfigFunction · 0.68