Skip to content

Commit

Permalink
remove project-wide deployment settings
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Dec 13, 2024
1 parent 43178b5 commit 91f5b18
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,22 +442,12 @@ public byte[] generateBuildConfig() throws IOException {
}
return customBuildConfig != null
? customBuildConfig.getBytes(StandardCharsets.UTF_8)
: getProjectBuildConfig();
}

/**
* If a project build config exists, return this as a byte array, or null if not available.
*/
private byte[] getProjectBuildConfig() {
Project project = parentProject();
return project.buildConfig != null
? writeToBytes(project.buildConfig)
: null;
}

public String generateBuildConfigAsString() {
if (customBuildConfig != null) return customBuildConfig;
return writeToString(this.parentProject().buildConfig);
return null;
}

/** Convenience method to write serializable object (primarily for router/build config objects) to byte array. */
Expand Down Expand Up @@ -487,30 +477,9 @@ public byte[] generateRouterConfig() throws IOException {
customRouterConfig = downloadedConfig;
}

byte[] customRouterConfigString = customRouterConfig != null
return customRouterConfig != null
? customRouterConfig.getBytes(StandardCharsets.UTF_8)
: null;

byte[] routerConfigString = parentProject().routerConfig != null
? writeToBytes(parentProject().routerConfig)
: null;

// If both router configs are present, merge the JSON before returning
// Merger code from: https://stackoverflow.com/questions/35747813/how-to-merge-two-json-strings-into-one-in-java
if (customRouterConfigString != null && routerConfigString != null) {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> map1 = mapper.readValue(customRouterConfigString, Map.class);
Map<String, Object> map2 = mapper.readValue(routerConfigString, Map.class);
Map<String, Object> merged = new HashMap<String, Object>(map2);
merged.putAll(map1);
return mapper.writeValueAsString(merged).getBytes();
}

return customRouterConfigString != null
? customRouterConfigString
: routerConfigString != null
? routerConfigString
: null;
}

/** Generate router config for deployment as byte array (for writing to file output stream). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,4 @@
public class OtpBuildConfig implements Serializable {
private static final long serialVersionUID = 1L;

public Boolean fetchElevationUS;
// FIXME: elevation bucket causing NPE issue if missing values when deploying to OTP
// public S3Bucket elevationBucket;

public Boolean stationTransfers;

public Double subwayAccessTime;

/** Currently only supports no-configuration fares, e.g. New York or San Francisco */
public String fares;

public OtpBuildConfig() {}

public static class S3Bucket implements Serializable {
private static final long serialVersionUID = 1L;
public String accessKey;
public String secretKey;
public String bucketName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,5 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class OtpRouterConfig implements Serializable {
private static final long serialVersionUID = 1L;
public Double driveDistanceReluctance;

public Double stairsReluctance;

public Collection<Updater> updaters;

public ItineraryFilter itineraryFilters;

public static class ItineraryFilter implements Serializable {
private static final long serialVersionUID = 1L;
public String nonTransitGeneralizedCostLimit;
}

public static class Updater implements Serializable {
private static final long serialVersionUID = 1L;
public String type;

public Integer frequencySec;

public String sourceType;

public String url;

public String feedId;
}

public String requestLogFile;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public class Project extends Model {

public boolean useCustomOsmBounds;

public OtpBuildConfig buildConfig;

public OtpRouterConfig routerConfig;

public String organizationId;

/** Last successful auto deploy. **/
Expand Down Expand Up @@ -111,8 +107,6 @@ public List<OtpServer> availableOtpServers() {


public Project() {
this.buildConfig = new OtpBuildConfig();
this.routerConfig = new OtpRouterConfig();
this.useCustomOsmBounds = false;
}

Expand Down

0 comments on commit 91f5b18

Please sign in to comment.