You are here

function oauth2_user_wsclient_dev_settings in OAuth2 Login 8

Same name in this branch
  1. 8 oauth2_user/wsclient.inc \oauth2_user_wsclient_dev_settings()
  2. 8 oauth2_user/oauth2_user.api.php \oauth2_user_wsclient_dev_settings()
Same name and namespace in other branches
  1. 7.2 oauth2_user/wsclient.inc \oauth2_user_wsclient_dev_settings()
  2. 7.2 oauth2_user/oauth2_user.api.php \oauth2_user_wsclient_dev_settings()

Set curl options for development, testing and debug.

It can be used when defining a wsclient service, like this: $service->settings += oauth2_user_wsclient_dev_settings();

1 call to oauth2_user_wsclient_dev_settings()
oauth2_user_default_wsclient_service in oauth2_user/wsclient.inc
Implements hook_default_wsclient_service().

File

oauth2_user/oauth2_user.api.php, line 112
Functions that can be used by other modules.

Code

function oauth2_user_wsclient_dev_settings() {
  $skipssl = variable_get('oauth2_login_skipssl', TRUE);
  $proxy = variable_get('oauth2_login_proxy', '');
  $dev_settings = array();
  if ($skipssl) {

    // Skip checking the SSL certificate, for testing.
    $dev_settings['curl options'] = [
      CURLOPT_SSL_VERIFYPEER => FALSE,
      CURLOPT_SSL_VERIFYHOST => FALSE,
    ];
  }
  if ($proxy) {
    $dev_settings['curl options'][CURLOPT_PROXY] = $proxy;
  }
  return $dev_settings;
}