line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.83k stars 923 forks source link

[Idea] Use Pkl for Armeria configuration #5842

Open Dogacel opened 4 months ago

Dogacel commented 4 months ago

Pkl is a modern, open-source, type-safe configuration language developed and maintained by Apple.

Pkl — pronounced Pickle — is an embeddable configuration language which provides rich support for data templating and validation. It can be used from the command line, integrated in a build pipeline, or embedded in a program. Pkl scales from small to large, simple to complex, ad-hoc to repetitive configuration tasks.

https://github.com/apple/pkl

Pkl has first-class support for JVM languages. Pkl also supports Spring Boot configuration natively: https://pkl-lang.org/spring/current/usage.html

I think Armeria can potentially utilize Pkl as its primary configuration language. It is possible to support Pkl as well as JSON / YAML as the configuration language for the downstream users that create services using Armeria. Having a wider dynamic configuration for Armeria could mean it is possible to ship default configurations for various needs, such as templates for local development, prod, task executors, event loops, xds, k8s etc. This means developers can start using armeria quicker and more confidently.

Some things Pkl can potentially replace:

trustin commented 4 months ago

I'm somewhat concerned about introducing a new language people are not familiar with. Maybe we should consider YAML, or does Pkl also have YAML support?

Dogacel commented 4 months ago

I'm somewhat concerned about introducing a new language people are not familiar with. Maybe we should consider YAML, or does Pkl also have YAML support?

Yes, PKL can produce JSON/YAML/XML, it should be also possible to consume from those sources.

I'm just exploring the idea, do you find value in abstracting the configuration out using such language like Pkl?

trustin commented 4 months ago

I'm just exploring, too. :smile: I think it will be useful to have some official YAML configuration that's loaded by Armeria, which could provide an alternative to Java system properties.