chore(deps): update dependency spark to v2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Renovate Bot 2024-03-02 00:26:47 +13:00 committed by James Harton
parent 49c30c4dde
commit e4224a0daf
Signed by: james
GPG key ID: 90E82DAA13F624F4
8 changed files with 908 additions and 2162 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,888 @@
<!--
This file was generated by Spark. Do not edit it by hand.
-->
# DSL: Wayfarer.Dsl
The Wayfarer DSL for defining static proxy configurations.
## DSL options
## wayfarer
* [config](#module-config)
* health_checks
* check
* host_patterns
* pattern
* listeners
* http
* https
* targets
* http
* health_checks
* check
* https
* health_checks
* check
* plug
---
### config
* health_checks
* check
* host_patterns
* pattern
* listeners
* http
* https
* targets
* http
* health_checks
* check
* https
* health_checks
* check
* plug
* `:name` (`t:String.t/0`) -
##### health_checks
* check
###### check
* `:name` - A unique name for the health check.
* `:method` - The HTTP method to use for the request. Valid values are :get, :head, :post, :put, :delete, :connect, :options, :trace, :patch The default value is `:get`.
* `:connect_timeout` (`t:pos_integer/0`) - Connection timeout in milliseconds The default value is `5000`.
* `:response_timeout` (`t:pos_integer/0`) - Response timeout in milliseconds The default value is `500`.
* `:hostname` - The HTTP hostname to use when sending the request. Defaults to the IP address.
* `:interval` (`t:pos_integer/0`) - Interval in milliseconds The default value is `30000`.
* `:threshold` (`t:pos_integer/0`) - Success threshold The default value is `3`.
* `:path` (`t:String.t/0`) - Path The default value is `"/"`.
* `:success_codes` (one or a list of struct of type `Range`) - HTTP status codes which are considered successful. The default value is `[200..299]`.
##### host_patterns
* pattern
###### pattern
* `:pattern` (`t:String.t/0`) - Required. A hostname matching pattern.
##### listeners
* http
* https
###### http
* `:scheme` - Required. The listening protocol. Valid values are :http, :https
* `:address` - Required. The address of the interface to listen on.
* `:name` - A unique name for the listener (defaults to the URI).
* `:port` (`t:pos_integer/0`) - Required. The TCP port on which to listen for incoming connections.
* `:http_1_options` (`t:keyword/0`) - Options to configure the HTTP/1 stack in Bandit. The default value is `[]`.
* `:http_2_options` (`t:keyword/0`) - Options to configure the HTTP/2 stack in Bandit. The default value is `[]`.
* `:thousand_island_options` (`t:keyword/0`) - Possible options to configure a ThousandIsland server. The default value is `[]`.
* `:websocket_options` (`t:keyword/0`) - Options to configure the WebSocket stack in Bandit. The default value is `[]`.
###### https
* `:scheme` - Required. The listening protocol. Valid values are :http, :https
* `:address` - Required. The address of the interface to listen on.
* `:name` - A unique name for the listener (defaults to the URI).
* `:port` (`t:pos_integer/0`) - Required. The TCP port on which to listen for incoming connections.
* `:http_1_options` (`t:keyword/0`) - Options to configure the HTTP/1 stack in Bandit. The default value is `[]`.
* `:http_2_options` (`t:keyword/0`) - Options to configure the HTTP/2 stack in Bandit. The default value is `[]`.
* `:thousand_island_options` (`t:keyword/0`) - Possible options to configure a ThousandIsland server. The default value is `[]`.
* `:websocket_options` (`t:keyword/0`) - Options to configure the WebSocket stack in Bandit. The default value is `[]`.
* `:certfile` (`t:String.t/0`) - The path to a file containing the SSL certificate to use for this listener.
* `:keyfile` (`t:String.t/0`) - The path to a file containing the SSL key to use for this listener.
* `:cipher_suite` - Used to define a pre-selected set of ciphers, as described by `Plug.SSL.configure/1`. Valid values are nil, :strong, :compatible
##### targets
* http
* health_checks
* check
* https
* health_checks
* check
* plug
* `:algorithm` - The target selection algorithm. Valid values are :round_robin, :sticky The default value is `:round_robin`.
###### http
* health_checks
* check
* `:address` - Required. The address of the interface to listen on.
* `:name` - A unique name for the target (defaults to the URI).
* `:port` (`t:pos_integer/0`) - Required. The TCP port on which to listen for incoming connections.
####### health_checks
* check
######## check
* `:name` - A unique name for the health check.
* `:method` - The HTTP method to use for the request. Valid values are :get, :head, :post, :put, :delete, :connect, :options, :trace, :patch The default value is `:get`.
* `:connect_timeout` (`t:pos_integer/0`) - Connection timeout in milliseconds The default value is `5000`.
* `:response_timeout` (`t:pos_integer/0`) - Response timeout in milliseconds The default value is `500`.
* `:hostname` - The HTTP hostname to use when sending the request. Defaults to the IP address.
* `:interval` (`t:pos_integer/0`) - Interval in milliseconds The default value is `30000`.
* `:threshold` (`t:pos_integer/0`) - Success threshold The default value is `3`.
* `:path` (`t:String.t/0`) - Path The default value is `"/"`.
* `:success_codes` (one or a list of struct of type `Range`) - HTTP status codes which are considered successful. The default value is `[200..299]`.
###### https
* health_checks
* check
* `:address` - Required. The address of the interface to listen on.
* `:name` - A unique name for the target (defaults to the URI).
* `:port` (`t:pos_integer/0`) - Required. The TCP port on which to listen for incoming connections.
####### health_checks
* check
######## check
* `:name` - A unique name for the health check.
* `:method` - The HTTP method to use for the request. Valid values are :get, :head, :post, :put, :delete, :connect, :options, :trace, :patch The default value is `:get`.
* `:connect_timeout` (`t:pos_integer/0`) - Connection timeout in milliseconds The default value is `5000`.
* `:response_timeout` (`t:pos_integer/0`) - Response timeout in milliseconds The default value is `500`.
* `:hostname` - The HTTP hostname to use when sending the request. Defaults to the IP address.
* `:interval` (`t:pos_integer/0`) - Interval in milliseconds The default value is `30000`.
* `:threshold` (`t:pos_integer/0`) - Success threshold The default value is `3`.
* `:path` (`t:String.t/0`) - Path The default value is `"/"`.
* `:success_codes` (one or a list of struct of type `Range`) - HTTP status codes which are considered successful. The default value is `[200..299]`.
###### plug
* `:module` (module that adopts `Plug` or a module and options) - Required. A plug which can handle requests.
## wayfarer
### Nested DSLs
* [config](#wayfarer-config)
* health_checks
* check
* host_patterns
* pattern
* listeners
* http
* https
* targets
* http
* health_checks
* check
* https
* health_checks
* check
* plug
## wayfarer.config
```elixir
config name \\ nil
```
### Nested DSLs
* [health_checks](#wayfarer-config-health_checks)
* check
* [host_patterns](#wayfarer-config-host_patterns)
* pattern
* [listeners](#wayfarer-config-listeners)
* http
* https
* [targets](#wayfarer-config-targets)
* http
* health_checks
* check
* https
* health_checks
* check
* plug
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#wayfarer-config-name){: #wayfarer-config-name } | `String.t` | | |
## wayfarer.config.health_checks
### Nested DSLs
* [check](#wayfarer-config-health_checks-check)
## wayfarer.config.health_checks.check
```elixir
check name \\ nil
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#wayfarer-config-health_checks-check-name){: #wayfarer-config-health_checks-check-name } | `String.t \| nil` | | A unique name for the health check. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`method`](#wayfarer-config-health_checks-check-method){: #wayfarer-config-health_checks-check-method } | `:get \| :head \| :post \| :put \| :delete \| :connect \| :options \| :trace \| :patch` | `:get` | The HTTP method to use for the request. |
| [`connect_timeout`](#wayfarer-config-health_checks-check-connect_timeout){: #wayfarer-config-health_checks-check-connect_timeout } | `pos_integer` | `5000` | Connection timeout in milliseconds |
| [`response_timeout`](#wayfarer-config-health_checks-check-response_timeout){: #wayfarer-config-health_checks-check-response_timeout } | `pos_integer` | `500` | Response timeout in milliseconds |
| [`hostname`](#wayfarer-config-health_checks-check-hostname){: #wayfarer-config-health_checks-check-hostname } | `nil \| String.t` | | The HTTP hostname to use when sending the request. Defaults to the IP address. |
| [`interval`](#wayfarer-config-health_checks-check-interval){: #wayfarer-config-health_checks-check-interval } | `pos_integer` | `30000` | Interval in milliseconds |
| [`threshold`](#wayfarer-config-health_checks-check-threshold){: #wayfarer-config-health_checks-check-threshold } | `pos_integer` | `3` | Success threshold |
| [`path`](#wayfarer-config-health_checks-check-path){: #wayfarer-config-health_checks-check-path } | `String.t` | `"/"` | Path |
| [`success_codes`](#wayfarer-config-health_checks-check-success_codes){: #wayfarer-config-health_checks-check-success_codes } | `Range \| list(Range)` | `[200..299]` | HTTP status codes which are considered successful. |
### Introspection
Target: `Wayfarer.Dsl.HealthCheck`
### Introspection
Target: `Wayfarer.Dsl.HealthChecks`
## wayfarer.config.host_patterns
### Nested DSLs
* [pattern](#wayfarer-config-host_patterns-pattern)
## wayfarer.config.host_patterns.pattern
```elixir
pattern pattern
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`pattern`](#wayfarer-config-host_patterns-pattern-pattern){: #wayfarer-config-host_patterns-pattern-pattern .spark-required} | `String.t` | | A hostname matching pattern. |
### Introspection
Target: `Wayfarer.Dsl.HostPattern`
### Introspection
Target: `Wayfarer.Dsl.HostPatterns`
## wayfarer.config.listeners
### Nested DSLs
* [http](#wayfarer-config-listeners-http)
* [https](#wayfarer-config-listeners-https)
## wayfarer.config.listeners.http
```elixir
http address, port
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`address`](#wayfarer-config-listeners-http-address){: #wayfarer-config-listeners-http-address .spark-required} | `IP.Address \| String.t` | | The address of the interface to listen on. |
| [`port`](#wayfarer-config-listeners-http-port){: #wayfarer-config-listeners-http-port .spark-required} | `pos_integer` | | The TCP port on which to listen for incoming connections. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`scheme`](#wayfarer-config-listeners-http-scheme){: #wayfarer-config-listeners-http-scheme .spark-required} | `:http \| :https` | | The listening protocol. |
| [`name`](#wayfarer-config-listeners-http-name){: #wayfarer-config-listeners-http-name } | `nil \| String.t` | | A unique name for the listener (defaults to the URI). |
| [`http_1_options`](#wayfarer-config-listeners-http-http_1_options){: #wayfarer-config-listeners-http-http_1_options } | `keyword` | `[]` | Options to configure the HTTP/1 stack in Bandit. |
| [`http_2_options`](#wayfarer-config-listeners-http-http_2_options){: #wayfarer-config-listeners-http-http_2_options } | `keyword` | `[]` | Options to configure the HTTP/2 stack in Bandit. |
| [`thousand_island_options`](#wayfarer-config-listeners-http-thousand_island_options){: #wayfarer-config-listeners-http-thousand_island_options } | `keyword` | `[]` | Possible options to configure a ThousandIsland server. |
| [`websocket_options`](#wayfarer-config-listeners-http-websocket_options){: #wayfarer-config-listeners-http-websocket_options } | `keyword` | `[]` | Options to configure the WebSocket stack in Bandit. |
### Introspection
Target: `Wayfarer.Dsl.Listener`
## wayfarer.config.listeners.https
```elixir
https address, port
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`address`](#wayfarer-config-listeners-https-address){: #wayfarer-config-listeners-https-address .spark-required} | `IP.Address \| String.t` | | The address of the interface to listen on. |
| [`port`](#wayfarer-config-listeners-https-port){: #wayfarer-config-listeners-https-port .spark-required} | `pos_integer` | | The TCP port on which to listen for incoming connections. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`scheme`](#wayfarer-config-listeners-https-scheme){: #wayfarer-config-listeners-https-scheme .spark-required} | `:http \| :https` | | The listening protocol. |
| [`name`](#wayfarer-config-listeners-https-name){: #wayfarer-config-listeners-https-name } | `nil \| String.t` | | A unique name for the listener (defaults to the URI). |
| [`http_1_options`](#wayfarer-config-listeners-https-http_1_options){: #wayfarer-config-listeners-https-http_1_options } | `keyword` | `[]` | Options to configure the HTTP/1 stack in Bandit. |
| [`http_2_options`](#wayfarer-config-listeners-https-http_2_options){: #wayfarer-config-listeners-https-http_2_options } | `keyword` | `[]` | Options to configure the HTTP/2 stack in Bandit. |
| [`thousand_island_options`](#wayfarer-config-listeners-https-thousand_island_options){: #wayfarer-config-listeners-https-thousand_island_options } | `keyword` | `[]` | Possible options to configure a ThousandIsland server. |
| [`websocket_options`](#wayfarer-config-listeners-https-websocket_options){: #wayfarer-config-listeners-https-websocket_options } | `keyword` | `[]` | Options to configure the WebSocket stack in Bandit. |
| [`certfile`](#wayfarer-config-listeners-https-certfile){: #wayfarer-config-listeners-https-certfile } | `String.t` | | The path to a file containing the SSL certificate to use for this listener. |
| [`keyfile`](#wayfarer-config-listeners-https-keyfile){: #wayfarer-config-listeners-https-keyfile } | `String.t` | | The path to a file containing the SSL key to use for this listener. |
| [`cipher_suite`](#wayfarer-config-listeners-https-cipher_suite){: #wayfarer-config-listeners-https-cipher_suite } | `nil \| :strong \| :compatible` | | Used to define a pre-selected set of ciphers, as described by `Plug.SSL.configure/1`. |
### Introspection
Target: `Wayfarer.Dsl.Listener`
### Introspection
Target: `Wayfarer.Dsl.Listeners`
## wayfarer.config.targets
### Nested DSLs
* [http](#wayfarer-config-targets-http)
* health_checks
* check
* [https](#wayfarer-config-targets-https)
* health_checks
* check
* [plug](#wayfarer-config-targets-plug)
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`algorithm`](#wayfarer-config-targets-algorithm){: #wayfarer-config-targets-algorithm } | `:round_robin \| :sticky` | `:round_robin` | The target selection algorithm. |
## wayfarer.config.targets.http
```elixir
http address, port
```
### Nested DSLs
* [health_checks](#wayfarer-config-targets-http-health_checks)
* check
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`address`](#wayfarer-config-targets-http-address){: #wayfarer-config-targets-http-address .spark-required} | `IP.Address \| String.t` | | The address of the interface to listen on. |
| [`port`](#wayfarer-config-targets-http-port){: #wayfarer-config-targets-http-port .spark-required} | `pos_integer` | | The TCP port on which to listen for incoming connections. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#wayfarer-config-targets-http-name){: #wayfarer-config-targets-http-name } | `nil \| String.t` | | A unique name for the target (defaults to the URI). |
## wayfarer.config.targets.http.health_checks
### Nested DSLs
* [check](#wayfarer-config-targets-http-health_checks-check)
## wayfarer.config.targets.http.health_checks.check
```elixir
check name \\ nil
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#wayfarer-config-targets-http-health_checks-check-name){: #wayfarer-config-targets-http-health_checks-check-name } | `String.t \| nil` | | A unique name for the health check. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`method`](#wayfarer-config-targets-http-health_checks-check-method){: #wayfarer-config-targets-http-health_checks-check-method } | `:get \| :head \| :post \| :put \| :delete \| :connect \| :options \| :trace \| :patch` | `:get` | The HTTP method to use for the request. |
| [`connect_timeout`](#wayfarer-config-targets-http-health_checks-check-connect_timeout){: #wayfarer-config-targets-http-health_checks-check-connect_timeout } | `pos_integer` | `5000` | Connection timeout in milliseconds |
| [`response_timeout`](#wayfarer-config-targets-http-health_checks-check-response_timeout){: #wayfarer-config-targets-http-health_checks-check-response_timeout } | `pos_integer` | `500` | Response timeout in milliseconds |
| [`hostname`](#wayfarer-config-targets-http-health_checks-check-hostname){: #wayfarer-config-targets-http-health_checks-check-hostname } | `nil \| String.t` | | The HTTP hostname to use when sending the request. Defaults to the IP address. |
| [`interval`](#wayfarer-config-targets-http-health_checks-check-interval){: #wayfarer-config-targets-http-health_checks-check-interval } | `pos_integer` | `30000` | Interval in milliseconds |
| [`threshold`](#wayfarer-config-targets-http-health_checks-check-threshold){: #wayfarer-config-targets-http-health_checks-check-threshold } | `pos_integer` | `3` | Success threshold |
| [`path`](#wayfarer-config-targets-http-health_checks-check-path){: #wayfarer-config-targets-http-health_checks-check-path } | `String.t` | `"/"` | Path |
| [`success_codes`](#wayfarer-config-targets-http-health_checks-check-success_codes){: #wayfarer-config-targets-http-health_checks-check-success_codes } | `Range \| list(Range)` | `[200..299]` | HTTP status codes which are considered successful. |
### Introspection
Target: `Wayfarer.Dsl.HealthCheck`
### Introspection
Target: `Wayfarer.Dsl.HealthChecks`
### Introspection
Target: `Wayfarer.Dsl.Target`
## wayfarer.config.targets.https
```elixir
https address, port
```
### Nested DSLs
* [health_checks](#wayfarer-config-targets-https-health_checks)
* check
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`address`](#wayfarer-config-targets-https-address){: #wayfarer-config-targets-https-address .spark-required} | `IP.Address \| String.t` | | The address of the interface to listen on. |
| [`port`](#wayfarer-config-targets-https-port){: #wayfarer-config-targets-https-port .spark-required} | `pos_integer` | | The TCP port on which to listen for incoming connections. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#wayfarer-config-targets-https-name){: #wayfarer-config-targets-https-name } | `nil \| String.t` | | A unique name for the target (defaults to the URI). |
## wayfarer.config.targets.https.health_checks
### Nested DSLs
* [check](#wayfarer-config-targets-https-health_checks-check)
## wayfarer.config.targets.https.health_checks.check
```elixir
check name \\ nil
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#wayfarer-config-targets-https-health_checks-check-name){: #wayfarer-config-targets-https-health_checks-check-name } | `String.t \| nil` | | A unique name for the health check. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`method`](#wayfarer-config-targets-https-health_checks-check-method){: #wayfarer-config-targets-https-health_checks-check-method } | `:get \| :head \| :post \| :put \| :delete \| :connect \| :options \| :trace \| :patch` | `:get` | The HTTP method to use for the request. |
| [`connect_timeout`](#wayfarer-config-targets-https-health_checks-check-connect_timeout){: #wayfarer-config-targets-https-health_checks-check-connect_timeout } | `pos_integer` | `5000` | Connection timeout in milliseconds |
| [`response_timeout`](#wayfarer-config-targets-https-health_checks-check-response_timeout){: #wayfarer-config-targets-https-health_checks-check-response_timeout } | `pos_integer` | `500` | Response timeout in milliseconds |
| [`hostname`](#wayfarer-config-targets-https-health_checks-check-hostname){: #wayfarer-config-targets-https-health_checks-check-hostname } | `nil \| String.t` | | The HTTP hostname to use when sending the request. Defaults to the IP address. |
| [`interval`](#wayfarer-config-targets-https-health_checks-check-interval){: #wayfarer-config-targets-https-health_checks-check-interval } | `pos_integer` | `30000` | Interval in milliseconds |
| [`threshold`](#wayfarer-config-targets-https-health_checks-check-threshold){: #wayfarer-config-targets-https-health_checks-check-threshold } | `pos_integer` | `3` | Success threshold |
| [`path`](#wayfarer-config-targets-https-health_checks-check-path){: #wayfarer-config-targets-https-health_checks-check-path } | `String.t` | `"/"` | Path |
| [`success_codes`](#wayfarer-config-targets-https-health_checks-check-success_codes){: #wayfarer-config-targets-https-health_checks-check-success_codes } | `Range \| list(Range)` | `[200..299]` | HTTP status codes which are considered successful. |
### Introspection
Target: `Wayfarer.Dsl.HealthCheck`
### Introspection
Target: `Wayfarer.Dsl.HealthChecks`
### Introspection
Target: `Wayfarer.Dsl.Target`
## wayfarer.config.targets.plug
```elixir
plug module
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`module`](#wayfarer-config-targets-plug-module){: #wayfarer-config-targets-plug-module .spark-required} | `module` | | A plug which can handle requests. |
### Introspection
Target: `Wayfarer.Dsl.Target`
### Introspection
Target: `Wayfarer.Dsl.Targets`
### Introspection
Target: `Wayfarer.Dsl.Config`
<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>

View file

@ -3,7 +3,7 @@ defmodule Wayfarer.Dsl.Target do
A struct for storing a target generated by the DSL.
"""
alias Spark.{Dsl.Entity, OptionsHelpers}
alias Spark.{Dsl.Entity, Options}
alias Wayfarer.Dsl.{HealthCheck, HealthChecks}
alias Wayfarer.Utils
@ -98,8 +98,8 @@ defmodule Wayfarer.Dsl.Target do
@doc false
def schema do
@shared_schema
|> OptionsHelpers.make_optional!(:address)
|> OptionsHelpers.make_optional!(:port)
|> Options.Helpers.make_optional!(:address)
|> Options.Helpers.make_optional!(:port)
|> Keyword.merge(
scheme: [
type: {:in, [:http, :https, :plug]},

View file

@ -3,7 +3,7 @@ defmodule Wayfarer.Listener do
use GenServer, restart: :transient
require Logger
alias Spark.OptionsHelpers
alias Spark.Options
import Wayfarer.Utils
@options_schema [
@ -90,7 +90,7 @@ defmodule Wayfarer.Listener do
## Options
#{OptionsHelpers.docs(@options_schema)}
#{Options.docs(@options_schema)}
"""
@doc false
@ -126,14 +126,14 @@ defmodule Wayfarer.Listener do
{:ok, :https} ->
schema =
@options_schema
|> OptionsHelpers.make_required!(:keyfile)
|> OptionsHelpers.make_required!(:certfile)
|> OptionsHelpers.make_required!(:cipher_suite)
|> Options.Helpers.make_required!(:keyfile)
|> Options.Helpers.make_required!(:certfile)
|> Options.Helpers.make_required!(:cipher_suite)
OptionsHelpers.validate(options, schema)
Options.validate(options, schema)
_ ->
OptionsHelpers.validate(options, @options_schema)
Options.validate(options, @options_schema)
end
end

View file

@ -1,5 +1,5 @@
defmodule Wayfarer.Server do
alias Spark.OptionsHelpers
alias Spark.Options
alias Wayfarer.{Dsl, Listener, Router, Server, Target}
use GenServer
require Logger
@ -78,7 +78,7 @@ defmodule Wayfarer.Server do
## Options
#{OptionsHelpers.docs(@options_schema)}
#{Options.docs(@options_schema)}
"""
@type options :: keyword
@ -145,7 +145,7 @@ defmodule Wayfarer.Server do
@impl true
@spec init(options) :: {:ok, map} | {:stop, any}
def init(options) do
with {:ok, options} <- OptionsHelpers.validate(options, @options_schema),
with {:ok, options} <- Options.validate(options, @options_schema),
{:ok, module} <- assert_is_server(options[:module]),
listeners <- Keyword.get(options, :listeners, []),
targets <- Keyword.get(options, :targets, []),

View file

@ -3,7 +3,7 @@ defmodule Wayfarer.Target do
use GenServer, restart: :transient
require Logger
alias Spark.OptionsHelpers
alias Spark.Options
alias Wayfarer.{Dsl.HealthCheck, Router, Server, Target}
import Wayfarer.Utils
@ -61,7 +61,7 @@ defmodule Wayfarer.Target do
## Options
#{OptionsHelpers.docs(@options_schema)}
#{Options.docs(@options_schema)}
"""
@type key :: {module, :http | :https, IP.Address.t(), :socket.port_number()}
@ -90,7 +90,7 @@ defmodule Wayfarer.Target do
@doc false
@impl true
def init(options) do
with {:ok, options} <- OptionsHelpers.validate(options, @options_schema),
with {:ok, options} <- Options.validate(options, @options_schema),
{:ok, uri} <- to_uri(options[:scheme], options[:address], options[:port]) do
target = options |> Keyword.take(~w[scheme address port]a) |> Map.new()
module = options[:module]

View file

@ -95,7 +95,7 @@ defmodule Wayfarer.MixProject do
{:mint, "~> 1.5"},
{:nimble_options, "~> 1.0"},
{:plug, "~> 1.15"},
{:spark, "~> 1.1"},
{:spark, "~> 2.0"},
{:telemetry, "~> 1.2"},
{:websock, "~> 0.5"},

View file

@ -25,12 +25,12 @@
"mimic": {:hex, :mimic, "1.7.4", "cd2772ffbc9edefe964bc668bfd4059487fa639a5b7f1cbdf4fd22946505aa4f", [:mix], [], "hexpm", "437c61041ecf8a7fae35763ce89859e4973bb0666e6ce76d75efc789204447c3"},
"mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"},
"mix_audit": {:hex, :mix_audit, "2.1.1", "653aa6d8f291fc4b017aa82bdb79a4017903902ebba57960ef199cbbc8c008a1", [:make, :mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.9", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "541990c3ab3a7bb8c4aaa2ce2732a4ae160ad6237e5dcd5ad1564f4f85354db1"},
"nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"},
"nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
"plug": {:hex, :plug, "1.15.1", "b7efd81c1a1286f13efb3f769de343236bd8b7d23b4a9f40d3002fc39ad8f74c", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "459497bd94d041d98d948054ec6c0b76feacd28eec38b219ca04c0de13c79d30"},
"plug_crypto": {:hex, :plug_crypto, "2.0.0", "77515cc10af06645abbfb5e6ad7a3e9714f805ae118fa1a70205f80d2d70fe73", [:mix], [], "hexpm", "53695bae57cc4e54566d993eb01074e4d894b65a3766f1c43e2c61a1b0f45ea9"},
"sourceror": {:hex, :sourceror, "0.14.0", "b6b8552d0240400d66b6f107c1bab7ac1726e998efc797f178b7b517e928e314", [:mix], [], "hexpm", "809c71270ad48092d40bbe251a133e49ae229433ce103f762a2373b7a10a8d8b"},
"spark": {:hex, :spark, "1.1.48", "64b804711818526e371d12ea3acc886365b14239565e361001aad801a38bad85", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.5 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.1", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "3215a8b1bb1dc93945ce9a0f68430d7265ea596c6b911f7bd6dba77b65cee370"},
"sourceror": {:hex, :sourceror, "1.0.1", "ec2c41726d181adce888ac94b3f33b359a811b46e019c084509e02c70042e424", [:mix], [], "hexpm", "28225464ffd68bda1843c974f3ff7ccef35e29be09a65dfe8e3df3f7e3600c57"},
"spark": {:hex, :spark, "2.0.1", "6701ca7908923767f60d1a9df7274053e2f7c8a0a594452006d038b05193e450", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "cc3c871dc40184edf2253d1fffcaa931856dac28c6990c4a202bc61f529e266a"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"thousand_island": {:hex, :thousand_island, "1.1.0", "dcc115650adc61c5e7de12619f0cb94b2b8f050326e7f21ffbf6fdeb3d291e4c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7745cf71520d74e119827ff32c2da6307e822cf835bebed3b2c459cc57f32d21"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},