Skip to content

Commit

Permalink
Update documentation and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
geirolz committed Jun 22, 2023
1 parent da5f27c commit 716b728
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 7 deletions.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,36 @@ object Main extends IOApp {
libraryDependencies += "com.github.geirolz" %% "app-toolkit-config-pureconfig" % "0.0.7"
```

Which allows you to use `withPureConfigLoader` to load the config from a `ConfigSource.default`

```scala

import cats.Show
import com.geirolz.app.toolkit.config.pureconfig.syntax.*

case class TestConfig(value: String)

object TestConfig {
implicit val show: Show[TestConfig] = Show.fromToString
implicit val configReader: pureconfig.ConfigReader[TestConfig] =
pureconfig.ConfigReader.forProduct1("value")(TestConfig.apply)
}

App[IO]
.withInfo(
SimpleAppInfo.string(
name = "app-toolkit",
version = "0.0.1",
scalaVersion = "2.13.10",
sbtVersion = "1.8.0"
)
)
.withPureConfigLoader[TestConfig]
.withoutDependencies
.provideOne(_ => IO.unit)
.run_
```

#### log4cats

```sbt
Expand All @@ -119,4 +149,4 @@ libraryDependencies += "com.github.geirolz" %% "app-toolkit-log4cats" % "0.0.7"

```sbt
libraryDependencies += "com.github.geirolz" %% "app-toolkit-odin" % "0.0.7"
```
```
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ lazy val docs: Project =
project
.in(file("docs"))
.enablePlugins(MdocPlugin)
.dependsOn(core, config)
.dependsOn(core, config, log4cats, odin, `config-pureconfig`)
.settings(
baseSettings,
noPublishSettings,
Expand Down
38 changes: 34 additions & 4 deletions docs/compiled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
A small toolkit to build functional app with managed resources

```sbt
libraryDependencies += "com.github.geirolz" %% "app-toolkit-core" % "0.0.6"
libraryDependencies += "com.github.geirolz" %% "app-toolkit-core" % "0.0.7"
```

Check the full example [here](https://github.com/geirolz/app-toolkit/tree/main/example)
Expand Down Expand Up @@ -106,17 +106,47 @@ object Main extends IOApp {
#### pureconfig

```sbt
libraryDependencies += "com.github.geirolz" %% "app-toolkit-config-pureconfig" % "0.0.6"
libraryDependencies += "com.github.geirolz" %% "app-toolkit-config-pureconfig" % "0.0.7"
```

Which allows you to use `withPureConfigLoader` to load the config from a `ConfigSource.default`

```scala

import cats.Show
import com.geirolz.app.toolkit.config.pureconfig.syntax.*

case class TestConfig(value: String)

object TestConfig {
implicit val show: Show[TestConfig] = Show.fromToString
implicit val configReader: pureconfig.ConfigReader[TestConfig] =
pureconfig.ConfigReader.forProduct1("value")(TestConfig.apply)
}

App[IO]
.withInfo(
SimpleAppInfo.string(
name = "app-toolkit",
version = "0.0.1",
scalaVersion = "2.13.10",
sbtVersion = "1.8.0"
)
)
.withPureConfigLoader[TestConfig]
.withoutDependencies
.provideOne(_ => IO.unit)
.run_
```

#### log4cats

```sbt
libraryDependencies += "com.github.geirolz" %% "app-toolkit-log4cats" % "0.0.6"
libraryDependencies += "com.github.geirolz" %% "app-toolkit-log4cats" % "0.0.7"
```

#### odin

```sbt
libraryDependencies += "com.github.geirolz" %% "app-toolkit-odin" % "0.0.6"
libraryDependencies += "com.github.geirolz" %% "app-toolkit-odin" % "0.0.7"
```
30 changes: 30 additions & 0 deletions docs/source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,36 @@ object Main extends IOApp {
libraryDependencies += "com.github.geirolz" %% "app-toolkit-config-pureconfig" % "@VERSION@"
```

Which allows you to use `withPureConfigLoader` to load the config from a `ConfigSource.default`

```scala mdoc:silent

import cats.Show
import com.geirolz.app.toolkit.config.pureconfig.syntax.*

case class TestConfig(value: String)

object TestConfig {
implicit val show: Show[TestConfig] = Show.fromToString
implicit val configReader: pureconfig.ConfigReader[TestConfig] =
pureconfig.ConfigReader.forProduct1("value")(TestConfig.apply)
}

App[IO]
.withInfo(
SimpleAppInfo.string(
name = "app-toolkit",
version = "0.0.1",
scalaVersion = "2.13.10",
sbtVersion = "1.8.0"
)
)
.withPureConfigLoader[TestConfig]
.withoutDependencies
.provideOne(_ => IO.unit)
.run_
```

#### log4cats

```sbt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.geirolz.app.toolkit.config.pureconfig.syntax.*
import com.geirolz.example.app.provided.AppHttpServer
import org.typelevel.log4cats.slf4j.Slf4jLogger

object App extends IOApp:
object AppMain extends IOApp:
override def run(args: List[String]): IO[ExitCode] =
App[IO]
.withInfo(AppInfo.fromBuildInfo)
Expand Down

0 comments on commit 716b728

Please sign in to comment.