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

Update latest pekko-http to bring in cors #106

Merged

Conversation

mdedetrich
Copy link
Contributor

Also removes the now unnecessary Snapshot OSS repo, removes other workarounds and updates pekko core to 1.0.0-RC3.

@mdedetrich mdedetrich force-pushed the update-latest-pekko-http-bring-in-cors branch 6 times, most recently from 4b4e349 to 0563fb1 Compare July 5, 2023 09:28

@ApiMayChange
object WebHandler {

/** Default CORS settings to use for grpc-web */
val defaultCorsSettings: CorsSettings = CorsSettings.defaultSettings
val defaultCorsSettings: CorsSettings = CorsSettings(ConfigFactory.load())
Copy link
Contributor Author

@mdedetrich mdedetrich Jul 5, 2023

Choose a reason for hiding this comment

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

@lomigmegard So I am trying to get rid of the now deprecated CorsSettings.defaultSettings, do you think this is fine for now given that we don't want to change the API for the first release? Passing either Config or ActorSystem as a parameter to defaultCorsSettings while changing it to a def would require more significant changes.

I suspect that this API can use improvements in future versions (and it is marked as @ApiMayChange).

Copy link
Member

Choose a reason for hiding this comment

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

Can this refers to actorsystem's config? or will have another config instance.

Copy link
Contributor Author

@mdedetrich mdedetrich Jul 5, 2023

Choose a reason for hiding this comment

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

Making this refer to the ActorSystem's config will require more significant code changes, i.e. defaultCorsSettings will have to change to a def and due to the usage of implicit default paramters in https://github.com/mdedetrich/incubator-pekko-grpc/blob/0563fb1672c6ca831423d02925687c8635fd0d03/runtime/src/main/scala/org/apache/pekko/grpc/scaladsl/WebHandler.scala#L63 it will also require rewiring of code.

Or as you said it will need us to create a new actor system instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

we want to retain good compatibility with akka-http-cors - so big refactors should wait till a later pekko-http release

Copy link
Contributor Author

@mdedetrich mdedetrich Jul 5, 2023

Choose a reason for hiding this comment

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

Also to note, CorsSettings(ConfigFactory.load()) is semantically the same as the original CorsSettings.defaultSettings

Copy link
Contributor

Choose a reason for hiding this comment

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

@mdedetrich that should be fine yes, given the constraints of not changing the interface of this field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, merging then!

@@ -32,8 +34,6 @@ import pekko.japi.function.{ Function => JFunction }
import pekko.stream.Materializer
import pekko.stream.javadsl.{ Keep, Sink, Source }
import pekko.util.ConstantFun
import ch.megard.pekko.http.cors.javadsl.settings.CorsSettings
import ch.megard.pekko.http.cors.javadsl.CorsDirectives
Copy link
Member

Choose a reason for hiding this comment

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

Cool

Copy link
Member

@He-Pin He-Pin left a comment

Choose a reason for hiding this comment

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

lgtm

@mdedetrich mdedetrich force-pushed the update-latest-pekko-http-bring-in-cors branch from 0563fb1 to dd70c28 Compare July 5, 2023 10:28
@mdedetrich mdedetrich merged commit 6141244 into apache:main Jul 6, 2023
@mdedetrich mdedetrich deleted the update-latest-pekko-http-bring-in-cors branch July 6, 2023 12:05
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.

4 participants