From 5150224e6615049506857787a871e17cd5f15859 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 27 Feb 2024 11:50:32 +0100 Subject: [PATCH] Read RASPAP_API_KEY from Dotenv --- includes/restapi.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/restapi.php b/includes/restapi.php index 910533c2..3a2b100c 100644 --- a/includes/restapi.php +++ b/includes/restapi.php @@ -3,6 +3,10 @@ require_once 'includes/functions.php'; require_once 'config.php'; +$env = dirname(__DIR__, 1); +$dotenv = Dotenv\Dotenv::createImmutable($env); +$dotenv->safeLoad(); + /** * Handler for RestAPI settings */ @@ -12,7 +16,7 @@ function DisplayRestAPI() $status = new \RaspAP\Messages\StatusMessage; // set defaults - $apiKey = "Hx80npaPTol9fKeBnPwX7ib2"; //placeholder + $apiKey = $_ENV['RASPAP_API_KEY']; if (!RASPI_MONITOR_ENABLED) { if (isset($_POST['SaveAPIsettings'])) {