-
Notifications
You must be signed in to change notification settings - Fork 53
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
support new Url
config fields
#577
Conversation
Url
config fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me, two small questions
src/main/java/com/conveyal/datatools/manager/models/Deployment.java
Outdated
Show resolved
Hide resolved
@@ -453,6 +492,16 @@ private <O extends Serializable> String writeToString(O object) { | |||
public byte[] generateRouterConfig() throws IOException { | |||
Project project = this.parentProject(); | |||
|
|||
if (this.customRouterConfigUrl != null) { | |||
try { | |||
// TODO: should Mongo be updated here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment be added above the line for this.customBuildConfig
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is targeted at you. Is leaving the comment the best bet do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not here, where will it be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I think in this line instead of updating the local instantiated Deployment we'd update Mongo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I see what you're saying now. Updating the mongo might be more in line with what we do currently elsewhere
@miles-grant-ibigroup I've made a few code changes, quicker than going back and forth through comments. I hope you don't mind. I've added a test, it might not be what you are looking for, but will at least test that the download from URL works. I'm not sure on saving to Mongo. How often will the downloaded config change and how often will it be download?! If you save the config to Mongo, you then have to deal with the logic around downloading a newer config. We can discuss this if you want? |
Thanks for your refactor I for the most part much prefer it! However, does this take into account that if no URL is set the buildConfig/routerConfig from Mongo should be used? |
I've made a small change to only assign the downloaded config if available. |
This looks great thanks so much! Things are working for me but would appreciate if someone else gave it a quick check too to make sure it still works |
I can give it a quick check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some more testing on this, it seems to be working well. I had two small comments on the new code as well.
@@ -453,6 +492,16 @@ private <O extends Serializable> String writeToString(O object) { | |||
public byte[] generateRouterConfig() throws IOException { | |||
Project project = this.parentProject(); | |||
|
|||
if (this.customRouterConfigUrl != null) { | |||
try { | |||
// TODO: should Mongo be updated here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I see what you're saying now. Updating the mongo might be more in line with what we do currently elsewhere
Checklist
dev
before they can be merged tomaster
)Description
Adds 2 new fields to
Deployment
that allow for downloading the router/build config from a URL. If the URL field is present, the old field is ignored, and a new file downloaded instead. Downloaded file is parsed only by Java's bulit-in toString method, so safety-wise we should be ok.Looking for feedback
Should mongo be updated when we download the data? Are errors handled well? How should we test this?