IPFSConfig.fromJson constructor

IPFSConfig.fromJson(
  1. Map<String, dynamic> json
)

Creates configuration from JSON

Implementation

factory IPFSConfig.fromJson(Map<String, dynamic> json) {
  return IPFSConfig(
    offline: json['offline'] as bool? ?? false,
    network: NetworkConfig.fromJson(
      json['network'] != null
          ? Map<String, dynamic>.from(json['network'] as Map)
          : {},
    ),
    dht: DHTConfig.fromJson(
      json['dht'] != null
          ? Map<String, dynamic>.from(json['dht'] as Map)
          : {},
    ),
    storage: StorageConfig.fromJson(
      json['storage'] != null
          ? Map<String, dynamic>.from(json['storage'] as Map)
          : {},
    ),
    security: SecurityConfig.fromJson(
      json['security'] != null
          ? Map<String, dynamic>.from(json['security'] as Map)
          : {},
    ),
    debug: json['debug'] as bool? ?? false,
    verboseLogging: json['verboseLogging'] as bool? ?? false,
    enablePubSub: json['enablePubSub'] as bool? ?? true,
    enableDHT: json['enableDHT'] as bool? ?? true,
    enableCircuitRelay: json['enableCircuitRelay'] as bool? ?? true,
    enableContentRouting: json['enableContentRouting'] as bool? ?? true,
    enableDNSLinkResolution: json['enableDNSLinkResolution'] as bool? ?? true,
    enableIPLD: json['enableIPLD'] as bool? ?? true,
    enableGraphsync: json['enableGraphsync'] as bool? ?? true,
    enableMetrics: json['enableMetrics'] as bool? ?? true,
    enableLogging: json['enableLogging'] as bool? ?? true,
    logLevel: json['logLevel'] as String? ?? 'info',
    enableQuotaManagement: json['enableQuotaManagement'] as bool? ?? true,
    defaultBandwidthQuota: json['defaultBandwidthQuota'] as int? ?? 1048576,
  );
}