MCPcopy
hub / github.com/openfga/openfga / NewConfig

Function NewConfig

pkg/storage/sqlcommon/sqlcommon.go:202–230  ·  view source on GitHub ↗

NewConfig creates a new Config instance with default values and applies any provided DatastoreOption modifications.

(opts ...DatastoreOption)

Source from the content-addressed store, hash-verified

200// NewConfig creates a new Config instance with default values
201// and applies any provided DatastoreOption modifications.
202func NewConfig(opts ...DatastoreOption) *Config {
203 cfg := &Config{}
204
205 for _, opt := range opts {
206 opt(cfg)
207 }
208
209 if cfg.Logger == nil {
210 cfg.Logger = logger.NewNoopLogger()
211 }
212
213 if cfg.MaxTuplesPerWriteField == 0 {
214 cfg.MaxTuplesPerWriteField = storage.DefaultMaxTuplesPerWrite
215 }
216
217 if cfg.MaxTypesPerModelField == 0 {
218 cfg.MaxTypesPerModelField = storage.DefaultMaxTypesPerAuthorizationModel
219 }
220
221 if cfg.PingTimeout == 0 {
222 cfg.PingTimeout = config.DefaultDatastorePingTimeout
223 }
224
225 if cfg.PingRetryMaxElapsedTime == 0 {
226 cfg.PingRetryMaxElapsedTime = config.DefaultDatastorePingRetryMaxElapsedTime
227 }
228
229 return cfg
230}
231
232// ContToken represents a continuation token structure used in pagination.
233type ContToken struct {

Calls 1

NewNoopLoggerFunction · 0.92

Used in the wild real call sites across dependent graphs

searching dependent graphs…