Skip to content

fix!: expose AdminServer controller from application context#228

Open
rlemaitre wants to merge 1 commit into
mainfrom
rlemaitre/fix/expose-admin-controller-from-app
Open

fix!: expose AdminServer controller from application context#228
rlemaitre wants to merge 1 commit into
mainfrom
rlemaitre/fix/expose-admin-controller-from-app

Conversation

@rlemaitre
Copy link
Copy Markdown
Member

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

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
@rlemaitre rlemaitre requested a review from Copilot April 4, 2025 14:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 thread modules/example/src/main/resources/config.yaml
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")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, I put the IO.sleep to test but it shouldn't be necessary, I remove it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But I fear that the OS doesn't release the port fast enough

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.

Application's admin controllers are not exposed by admin server

3 participants