Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove project-wide deployment settings #604

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
miles-grant-ibigroup marked this conversation as resolved.
Show resolved Hide resolved
}

/** 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 {
miles-grant-ibigroup marked this conversation as resolved.
Show resolved Hide resolved
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 {
miles-grant-ibigroup marked this conversation as resolved.
Show resolved Hide resolved
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
Loading