Skip to content

Commit

Permalink
docs: Config reference
Browse files Browse the repository at this point in the history
  • Loading branch information
igneus committed Feb 27, 2025
1 parent 33fe330 commit 5aa9700
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/reference/configs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
id: configs
title: Config Reference
---

This is a listing of all ZIO HTTP Configs and their options.

```scala mdoc:passthrough
import zio.http.docs.ConfigReference
println(ConfigReference.build())
```
35 changes: 35 additions & 0 deletions zio-http-docs/src/main/scala/zio/http/docs/ConfigReference.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package zio.http.docs

import zio.config.generateDocs
import zio._

object ConfigReference {
private type ObjectWithConfig = Object{def config: Config[Any]}

private val configs =
Seq[ObjectWithConfig](
http.netty.NettyConfig,
http.netty.NettyConfig.LeakDetectionLevel,
http.ConnectionPoolConfig,
http.Decompression,
http.DnsResolver.Config,
http.DnsResolver.ExpireAction,
http.Proxy,
http.Server.Config,
http.URL,
// http.ZClient.Config, // TODO: causes stack overflow
// http.gen.openapi.Config, // TODO
).map { obj => (
obj.getClass.getName.stripSuffix("$").replace("$", "."),
obj.config
) }

def build(): String = {
configs.map(item => {
val (name, config) = item

s"# ${name}.config\n" +
generateDocs(config).toTable.toGithubFlavouredMarkdown
}).mkString("\n")
}
}

0 comments on commit 5aa9700

Please sign in to comment.