FaunaConfig.build constructor

FaunaConfig.build({
  1. required String secret,
  2. Scheme scheme = Scheme.HTTPS,
  3. String domain = 'db.fauna.com',
  4. int? port,
  5. Map<String, String> headers = const {},
  6. Duration timeout = const Duration(minutes: 1),
  7. Duration? queryTimeout,
})

Builds a FaunaConfig with sensible defaults. A FaunaDB secret must be provided.

Docs on how to create a secret can be found here.

By default, baseUrl is https://db.fauna.com:443. This is the URL the FaunaClient will query.

Implementation

factory FaunaConfig.build({
  required String secret,
  Scheme scheme = Scheme.HTTPS,
  String domain = 'db.fauna.com',
  int? port,
  Map<String, String> headers = const {},
  Duration timeout = const Duration(minutes: 1),
  Duration? queryTimeout,
}) {
  return FaunaConfig(
    scheme: scheme,
    domain: domain,
    port: port ?? ((scheme == Scheme.HTTPS) ? 443 : 80),
    secret: secret,
    headers: headers,
    timeout: timeout,
    queryTimeout: queryTimeout,
  );
}