parseConnectionAddress method

Uri parseConnectionAddress(
  1. String url
)

Paser connection address.

Implementation

Uri parseConnectionAddress(String url) {
  final Uri uri = Uri.parse(url);

  if (!uri.isScheme('prisma')) {
    throw StateError(
        'Datasource URL must use prisma:// protocol when --data-proxy is used');
  }

  if (!uri.queryParameters.containsKey('api_key')) {
    throw StateError('No valid API key found in the datasource URL');
  }

  return uri;
}