Skip to content

Commit

Permalink
allow relative keyfile paths
Browse files Browse the repository at this point in the history
  • Loading branch information
nitriques committed Jun 4, 2015
1 parent eb9e625 commit 1a1512c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion content/content.index.php
Expand Up @@ -50,7 +50,7 @@ public function build() {

if (!($at = @json_decode($config['at']))) {
$html = <<<HTML
<h1>Server auth failed! Please check your configuration and make sure you have a valid access token</h1>
<h1>Server auth failed! Please check your configuration.</h1>
HTML;
}
else {
Expand Down
8 changes: 6 additions & 2 deletions extension.driver.php
Expand Up @@ -96,7 +96,7 @@ public function dashboard_panel_options($context) {
$label = Widget::Label('Google Analytics Service account email', Widget::Input('config[email]', $config['email']));
$fieldset->appendChild($label);

$label = Widget::Label('Google Analytics p12 key file path', Widget::Input('config[keyfile]', $config['keyfile']));
$label = Widget::Label('Google Analytics p12 key file path (absolute or DOCROOT relative)', Widget::Input('config[keyfile]', $config['keyfile']));
$fieldset->appendChild($label);

$label = Widget::Label('Height (include units)', Widget::Input('config[height]', $config['height']));
Expand Down Expand Up @@ -130,7 +130,11 @@ public function dashboard_panel_validate($context) {

public static function createClient(array $config, $panelId) {
$client = new Google_Client();
$key = @file_get_contents($config['keyfile']);
$keyfile = $config['keyfile'];
if (strpos($keyfile, '/') !== 0) {
$keyfile = DOCROOT . '/' . $keyfile;
}
$key = @file_get_contents($keyfile);
if (!!$key) {
$cred = new Google_Auth_AssertionCredentials(
$config['email'],
Expand Down

0 comments on commit 1a1512c

Please sign in to comment.