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

[SERV-830] get version from manifest #53

Closed
wants to merge 6 commits into from
Closed

[SERV-830] get version from manifest #53

wants to merge 6 commits into from

Conversation

DRickard
Copy link
Member

  • Add method to Config (shamelessly stolen from prl) to retrieve version from JAR manifest
  • Add call to Config method in MainVerticle
  • Add message to MessageBundle
  • Remove HAUTH_VERSION from pom

@DRickard DRickard added the enhancement New feature or request label Jul 21, 2023
@DRickard DRickard self-assigned this Jul 21, 2023
@DRickard DRickard marked this pull request as ready for review August 2, 2023 17:50
@DRickard DRickard requested a review from a team as a code owner August 2, 2023 17:50
}
} catch (final IOException details) {
// Either the app wasn't deployed as a JAR, or Vert.x Maven Plugin isn't creating the manifest file
LOGGER.warn(MessageCodes.AUTH_024, manifestPath, details.getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

Is the use of version in Hauth important enough to warrant an error?

Copy link
Member Author

@DRickard DRickard Aug 2, 2023

Choose a reason for hiding this comment

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

Per the README, HAUTH_VERSION is a required value, and Config.HAUTH_VERSION is referenced in AccessTokenHandler, AccessCookieHandler, AccessCookieServiceImpl, and SinaiAccessTokenHandler.

Copy link
Member

Choose a reason for hiding this comment

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

So, should it be more than a warning? Seems, to me, that missing something that's required should be an error, perhaps also bubbling up a failed future?

Choose a reason for hiding this comment

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

I was thinking that it would be nice (as an enhancement) for HTTP responses to include the Server header, which I'd see looking something like Hauth/x.y.z. Here's how prl-harvester deals with this (MDN says User-Agent and Server are usually in a similar format). However, simply the product name is also acceptable, so it's up to us on how strict we want to be with the value.

Choose a reason for hiding this comment

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

I like your suggestion @ksclarke

Copy link
Member Author

Choose a reason for hiding this comment

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

Can the function passed to ConfigRetriever.setConfigurationProcessor (here setAppVersion) return a Future? And if so, does that require changing how setConfigurationProcessor is handled?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, setAppVersion could return a future, but you're right you'd have to handle that instead of just passing the result to setConfigurationProcessor since that takes a function that returns a JsonObject: setConfigurationProcessor(Function<JsonObject, JsonObject> processor);.

@ksclarke
Copy link
Member

ksclarke commented Aug 2, 2023

Also, regarding "Remove HAUTH_VERSION from pom" -- it doesn't look like the POM was updated in this PR(?)

@DRickard
Copy link
Member Author

DRickard commented Aug 2, 2023

Also, regarding "Remove HAUTH_VERSION from pom" -- it doesn't look like the POM was updated in this PR(?)

The value was never literally removed. I commented out the entries in the pom, then eventually realized they were needed for the tests (which don't run from the deployed JAR and so can't get the version from the manifest file) and uncommented them.

@markmatney
Copy link

HAUTH_VERSION should be removed from the run configuration of the Hauth container, since it's able to pull it from the JAR. But yes, if we want to keep the equality assertions as-is (comparing entire JsonObjects that have HAUTH_VERSION keys), it must still be explicitly provided to Failsafe (although a comment in the POM explaining "why" might be a good idea).

@markmatney
Copy link

Also, it should be removed from the list of env vars in the README.

@ksclarke
Copy link
Member

Closing this old pull request because we're deprecating all the Java work and won't add new features to them any more. We'll only be doing bug fixes.

@ksclarke ksclarke closed this Dec 19, 2023
@ksclarke ksclarke deleted the SERV-830 branch December 19, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants