-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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
35
zio-http-docs/src/main/scala/zio/http/docs/ConfigReference.scala
This file contains 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
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") | ||
} | ||
} |