Skip to content

Commit

Permalink
use new config style in security guide
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Apr 18, 2021
1 parent 80f9a9c commit cecf76a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Updated security guide to use new configuration style

## 0.3.0 - 2021-04-18

### Added
Expand Down
14 changes: 6 additions & 8 deletions guides/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ if present.

## Using custom TLS certificates with Spear

A `Spear.Connection` takes an `:opts` option which is passed to
A `Spear.Connection` takes an `:mint_opts` option which is passed to
`Mint.HTTP.connect/4`. We can inform mint of our custom `./certs/ca/ca.crt`
CA certificate like so:

```elixir
connection_config = [
connection_string: "esdb://localhost:2113?tls=true",
opts: [
mint_opts: [
transport_opts: [
cacertfile: Path.join([__DIR__ | ~w(certs ca ca.crt)])
]
Expand Down Expand Up @@ -102,15 +102,13 @@ connection_config = [
## Credentials

Now that TLS is enabled, we can safely pass basic-auth credentials over the
network. `Spear.Connection` accepts a `:credentials` option as a two-tuple
of `{username, password}`. E.g. with the default login credentials, a
connection can be configured like so:
network. `Spear.Connection` accepts credentials through the connection string
or via the `:username` and `:password` options.

```elixir
connection_config = [
connection_string: "esdb://localhost:2113?tls=true",
credentials: {"admin", "changeit"},
opts: [
connection_string: "esdb://admin:changeit@localhost:2113?tls=true",
mint_opts: [
transport_opts: [
cacertfile: Path.join([__DIR__ | ~w(certs ca ca.crt)])
]
Expand Down

0 comments on commit cecf76a

Please sign in to comment.