Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip order for env vs flag for server attributes #971

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,34 @@ trait ApiOptions {
"Whether to respond to transaction requests, like adding or updating items. Default: 'false'."

private val enableTransactions = Opts
.flag(
"with-transactions",
help = enableTransactionsHelp
)
.orFalse orElse Opts
.env[String]("API_WITH_TRANSACTIONS", help = enableTransactionsHelp, metavar = "true||false")
.mapValidated { s =>
Validated
.fromTry(Try(s.toBoolean))
.leftMap(_ => s"Expected to find a value that can convert to a Boolean, but got $s")
.toValidatedNel
} withDefault (false)
} orElse Opts
.flag(
"with-transactions",
help = enableTransactionsHelp
)
.orFalse

private val enableTilesHelp = "Whether to include tile endpoints. Default: 'false'."

private val enableTiles = Opts
.flag(
"with-tiles",
help = enableTilesHelp
)
.orFalse orElse Opts
.env[String]("API_WITH_TILES", help = enableTilesHelp, metavar = "true||false")
.mapValidated { s =>
Validated
.fromTry(Try(s.toBoolean))
.leftMap(_ => s"Expected to find a value that can convert to a Boolean, but got $s")
.toValidatedNel
} withDefault (false)
} orElse Opts
.flag(
"with-tiles",
help = enableTilesHelp
)
.orFalse

private val runMigrations =
Opts.flag("run-migrations", "Run migrations before the API server starts").orFalse
Expand All @@ -110,5 +110,5 @@ trait ApiOptions {
enableTransactions,
enableTiles,
runMigrations
) mapN ApiConfig
) mapN ApiConfig.apply
}