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

support new Url config fields #577

Merged
merged 5 commits into from
Nov 27, 2023

Conversation

miles-grant-ibigroup
Copy link
Contributor

@miles-grant-ibigroup miles-grant-ibigroup commented Nov 20, 2023

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing
  • The description lists all relevant PRs included in this release (remove this if not merging to master)
  • e2e tests are all passing (remove this if not merging to master)

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?

@miles-grant-ibigroup miles-grant-ibigroup changed the title support new Url config fields support new Url config fields Nov 20, 2023
Copy link
Contributor

@philip-cline philip-cline left a 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

@@ -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?
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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

@br648
Copy link
Contributor

br648 commented Nov 21, 2023

@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?

@miles-grant-ibigroup
Copy link
Contributor Author

@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?

@br648
Copy link
Contributor

br648 commented Nov 21, 2023

@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.

@miles-grant-ibigroup
Copy link
Contributor Author

@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

@philip-cline
Copy link
Contributor

I can give it a quick check

Copy link
Contributor

@br648 br648 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@br648 br648 assigned philip-cline and unassigned br648 Nov 21, 2023
Copy link
Contributor

@philip-cline philip-cline left a 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?
Copy link
Contributor

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 miles-grant-ibigroup merged commit 272dbd3 into dev Nov 27, 2023
5 checks passed
@miles-grant-ibigroup miles-grant-ibigroup deleted the download-otp-configs-from-url branch November 27, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants