Skip to content

Commit

Permalink
Merge branch 'release/0.12.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Aug 2, 2023
2 parents 1cf076a + 3e0cec5 commit 02cede0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/formation/postgresql/credential.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule Formation.Postgresql.Credential do
embedded_schema do
field :host, :string, virtual: true
field :resource, :string, virtual: true
field :secure, :string, virtual: true

field :port, :integer, default: 5432
field :hostname, :string
Expand All @@ -31,6 +32,7 @@ defmodule Formation.Postgresql.Credential do
|> cast(params, @valid_attrs)
|> maybe_set_hostname()
|> maybe_set_database()
|> maybe_set_ssl()
|> validate_required([:hostname, :port, :username, :database])
end

Expand All @@ -51,6 +53,14 @@ defmodule Formation.Postgresql.Credential do
|> to_string()
end

defp maybe_set_ssl(changeset) do
if secure = get_change(changeset, :secure) do
put_change(changeset, :ssl, secure)
else
changeset
end
end

defp maybe_set_database(changeset) do
if resource = get_change(changeset, :resource) do
put_change(changeset, :database, resource)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Formation.MixProject do
def project do
[
app: :formation,
version: "0.12.2",
version: "0.12.3",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
description: description(),
Expand Down

0 comments on commit 02cede0

Please sign in to comment.