aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Procfile1
-rw-r--r--pom.xml28
-rw-r--r--settings/config.json6
-rw-r--r--src/main/java/Main.java13
-rw-r--r--src/main/java/utility/SpotifyAPI.java12
5 files changed, 13 insertions, 47 deletions
diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000..a3d21af
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+worker: java $JAVA_OPTS -cp target/classes:target/dependency/* src/main/java/Main.java \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f47c925..ddccf53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,39 +68,17 @@
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.3.0</version>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
+ <artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
+ <id>copy-dependencies</id>
<phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>Main</mainClass>
- </transformer>
- </transformers>
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <shadedArtifactAttached>true</shadedArtifactAttached>
- </configuration>
+ <goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>10</source>
- <target>10</target>
- </configuration>
- </plugin>
</plugins>
<resources>
<resource>
diff --git a/settings/config.json b/settings/config.json
deleted file mode 100644
index c4eb359..0000000
--- a/settings/config.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "discordToken": "",
- "youtubeApi": "",
- "spotifyClientID": "",
- "spotifyClientSecret": ""
-}
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
index fbb066a..636cd3b 100644
--- a/src/main/java/Main.java
+++ b/src/main/java/Main.java
@@ -11,18 +11,15 @@ public class Main extends ListenerAdapter {
public static void main( String[] args)
{
- new Music("$",readSetting("youtubeApi"),readSetting("discordToken"));
+ new Music("$",readSetting("YOUTUBEAPIKEY"),readSetting("DISCORDTOKEN"));
}
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");
}
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();
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage