Skip to content

Commit

Permalink
feat: check if apikey env is set on server side
Browse files Browse the repository at this point in the history
  • Loading branch information
jee-r committed Nov 18, 2023
1 parent 1e2b194 commit e671d00
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions public/patchwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// import functions
require_once '../src/functions.php';

// load Lastfm APIKEY from .env
require_once realpath(__DIR__ . "/../vendor/autoload.php");
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . "/..");
$dotenv->load();
if (!isset($_ENV["LASTFM_API_KEY"])) {
// load Lastfm APIKEY from .env
require_once realpath(__DIR__ . "/../vendor/autoload.php");
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . "/..");
$dotenv->load();
}

$apiKey = $_ENV['LASTFM_API_KEY'];

Expand Down

0 comments on commit e671d00

Please sign in to comment.