maybe this will work?
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 39s

This commit is contained in:
Lee 2024-04-29 06:49:12 +01:00
parent 123b01d1d0
commit 387c1b1f0c
3 changed files with 7 additions and 2 deletions

@ -11,6 +11,7 @@ public class GitUtils {
* @param files The files to commit * @param files The files to commit
*/ */
public static void commitFiles(String message, Path... files) { public static void commitFiles(String message, Path... files) {
System.out.println("Committing files");
if (System.getenv("ENVIRONMENT").equals("production")) { if (System.getenv("ENVIRONMENT").equals("production")) {
runCommand("git", "config", "--global", "user.email", "liam+pia-servers-ci@fascinated.cc"); runCommand("git", "config", "--global", "user.email", "liam+pia-servers-ci@fascinated.cc");
runCommand("git", "config", "--global", "user.name", "PIA Servers CI"); runCommand("git", "config", "--global", "user.name", "PIA Servers CI");
@ -27,6 +28,7 @@ public class GitUtils {
*/ */
public static void cloneRepo() { public static void cloneRepo() {
if (System.getenv("ENVIRONMENT").equals("production")) { if (System.getenv("ENVIRONMENT").equals("production")) {
System.out.println("Cloning repository");
runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git"); runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git");
} }
} }

@ -1,16 +1,19 @@
package cc.fascinated.piaservers.model; package cc.fascinated.piaservers.model;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.Date; import java.util.Date;
@AllArgsConstructor @Getter @Setter @AllArgsConstructor @Getter @Setter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class PiaServer { public class PiaServer {
/** /**
* The IP of this server. * The IP of this server.
*/ */
@EqualsAndHashCode.Include
private final String ip; private final String ip;
/** /**

@ -26,7 +26,7 @@ public class PiaManager {
private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient(); private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient();
private static final String PIA_OPENVPN_CONFIGS_URL = "https://www.privateinternetaccess.com/openvpn/openvpn.zip"; private static final String PIA_OPENVPN_CONFIGS_URL = "https://www.privateinternetaccess.com/openvpn/openvpn.zip";
private static final long REMOVAL_THRESHOLD = TimeUnit.DAYS.toMicros(14); // 2 weeks private static final long REMOVAL_THRESHOLD = TimeUnit.DAYS.toMicros(14); // 2 weeks
public static List<PiaServer> SERVERS = new ArrayList<>(); public static Set<PiaServer> SERVERS = new HashSet<>();
@SneakyThrows @SneakyThrows
public PiaManager() { public PiaManager() {
@ -38,7 +38,7 @@ public class PiaManager {
// Load the serversFile from the file // Load the serversFile from the file
SERVERS = Main.GSON.fromJson(Files.readString(serversFile.toPath()), new TypeToken<List<PiaServer>>() {}.getType()); SERVERS = Main.GSON.fromJson(Files.readString(serversFile.toPath()), new TypeToken<List<PiaServer>>() {}.getType());
if (SERVERS == null) { if (SERVERS == null) {
SERVERS = new ArrayList<>(); SERVERS = new HashSet<>();
} }
GitUtils.cloneRepo(); // Clone the repository GitUtils.cloneRepo(); // Clone the repository