fix!: expose AdminServer controller from application context#228
Open
rlemaitre wants to merge 1 commit into
Open
fix!: expose AdminServer controller from application context#228rlemaitre wants to merge 1 commit into
rlemaitre wants to merge 1 commit into
Conversation
This change ensures that the AdminServer controller is properly exposed from the application context, fixing the configuration setup needed for the admin endpoints to be accessible. BREAKING CHANGE: Changes how API controllers are defined and started. Controllers are now defined in the `controllers` field on `App` instead of being manually started in `Pillars.run`. The API server is now automatically started. Fixes #157
There was a problem hiding this comment.
Copilot reviewed 1 out of 11 changed files in this pull request and generated 1 comment.
Files not reviewed (10)
- modules/core-tests/src/main/scala/pillars/tests/suite.scala: Language not supported
- modules/core/src/main/scala/pillars/AdminServer.scala: Language not supported
- modules/core/src/main/scala/pillars/ApiServer.scala: Language not supported
- modules/core/src/main/scala/pillars/Config.scala: Language not supported
- modules/core/src/main/scala/pillars/HttpServer.scala: Language not supported
- modules/core/src/main/scala/pillars/Pillars.scala: Language not supported
- modules/core/src/main/scala/pillars/app.scala: Language not supported
- modules/core/src/main/scala/pillars/probes.scala: Language not supported
- modules/example/src/main/scala/example/app.scala: Language not supported
- modules/rabbitmq-fs2/src/test/scala/pillars/rabbitmq/fs2/RabbitMQTests.scala: Language not supported
Comments suppressed due to low confidence (1)
modules/example/src/main/resources/config.yaml:50
- Double-check if enabling the open-api in the API section unintentionally exposes sensitive endpoints or documentation in production. Consider limiting access to these endpoints if required.
enabled: true
Comment on lines
+65
to
+74
| hotswap <- Hotswap.create[IO, Server] | ||
| yield new HttpServer: | ||
| override def restartWith(endpoints: List[Controller]): IO[Unit] = | ||
| for | ||
| _ <- logger.info(s"Stopping ${usage.name} server") | ||
| _ <- hotswap.clear | ||
| _ <- logger.debug(s"${usage.name} server stopped") | ||
| _ <- IO.sleep(100.millis) | ||
| _ <- hotswap.swap(build(usage.name, config, openApi, infos, observability, endpoints.flatten)) | ||
| _ <- logger.info(s"${usage.name} server restarted") |
Contributor
There was a problem hiding this comment.
If the server can be initialized at startup the hotswap can be created with an initial value and using .clear + sleep won't nbe necessary
Member
Author
There was a problem hiding this comment.
Yep, I put the IO.sleep to test but it shouldn't be necessary, I remove it
Member
Author
There was a problem hiding this comment.
But I fear that the OS doesn't release the port fast enough
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change ensures that the AdminServer controller is properly exposed from the application context, fixing the configuration setup needed for the admin endpoints to be accessible.
BREAKING CHANGE: Changes how API controllers are defined and started. Controllers are now defined in the
controllersfield onAppinstead of being manually started inPillars.run. The API server is now automatically started.Fixes #157