From 60a320dc9e680868608efbd2e46ae0910b8ba5f2 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 22 Nov 2023 23:19:48 -0800 Subject: Added a Procfile - change settings config to env vars - allows for easier Heroku deployment Signed-off-by: Pinapelz --- src/main/java/utility/SpotifyAPI.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/main/java/utility/SpotifyAPI.java') diff --git a/src/main/java/utility/SpotifyAPI.java b/src/main/java/utility/SpotifyAPI.java index 4eb4d6e..acf79eb 100644 --- a/src/main/java/utility/SpotifyAPI.java +++ b/src/main/java/utility/SpotifyAPI.java @@ -83,15 +83,11 @@ public class SpotifyAPI { } } public static String readSetting(String parameter){ - Object obj = null; - - try { - obj = new JSONParser().parse(new FileReader("settings//config.json")); - } catch (Exception e) { - e.printStackTrace(); + String value = System.getenv(parameter); + if (value != null) { + return value; } - JSONObject jo = (JSONObject) obj; - return (String) jo.get(parameter); + throw new RuntimeException("Environment variable " + parameter + " not found"); } public static void checkRefreshToken(){ long unixTime = Instant.now().getEpochSecond(); -- cgit v1.2.3