Skip to content

Commit

Permalink
define config in php file
Browse files Browse the repository at this point in the history
closes #4
  • Loading branch information
aaronpk committed Nov 2, 2018
1 parent 566bfcf commit da176c0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
env.json
env.php
6 changes: 0 additions & 6 deletions env.example.json

This file was deleted.

5 changes: 5 additions & 0 deletions env.example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
define('OKTA_BASE_URL', 'https://dev-000000.oktapreview.com');
define('OKTA_CLIENT_ID', '');
define('OKTA_CLIENT_SECRET', '');
define('OKTA_AUTH_SERVER_ID', 'default');
11 changes: 2 additions & 9 deletions okta-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,10 @@ public function __construct()

// TODO: Refactor this after adding support
// for configuring this plugin via a settings page
if(file_exists(plugin_dir_path(__FILE__) . "env.json")) {
if(file_exists(plugin_dir_path(__FILE__) . "env.php")) {
/*******************************/
// Load environment variables
$json = file_get_contents(plugin_dir_path(__FILE__) . "env.json");
if ($json === false) {
die("could not open env.json file");
}
$env = json_decode($json, true);
foreach ($env as $k => $v) {
define($k, $v);
}
include(plugin_dir_path(__FILE__) . "env.php");
// [jpf] FIXME: Add support for configuring this plugin via a settings page:
// https://codex.wordpress.org/Creating_Options_Pages
/*******************************/
Expand Down

0 comments on commit da176c0

Please sign in to comment.