From 88146dbb5950ece8b1ad15dc097f7e563eb56823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Juri=C4=87?= Date: Fri, 22 Mar 2024 17:08:24 +0100 Subject: [PATCH] Bump version --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ README.md | 2 +- mix.exs | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4519a52..d532c86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.6.0 + +**Breaking**: changed the endpoint setup. Previously the client code had to configure https via the `Phoenix.Endpoint.init/2` callback. However, this callback is deprecated in the latest Phoenix, which now favours passing endpoint options via an argument to `start_link/1` (or `child_spec/1`). This style was previously not supported by site_encrypt. + +So to make all of this work, the setup flow has been changed and simplified. To upgrade from the previous version you need to do the following: + +1. Remove `use SiteEncrypt.Phoenix` from the endpoint module. +1. Replace `use Phoenix.Endpoint` with `use SiteEncrypt.Phoenix.Endpoint`. Keep the `:otp_app` option. +1. Remove invocation of `SiteEncrypt.Phoenix.configure_https/1` from your endpoint's `init/1`. +1. In the parent supervisor children list, replace the child `{SiteEncrypt.Phoenix, MyEndpoint}` with `MyEndpoint`. + +Note that `init/1` callback is deprecated. To specify endpoint config at runtime, you can use the spec `{MyEndpoint, endpoint_config}`. Alternatively, you can override the `child_spec/1` function in the endpoint module: + +```elixir +# in your endpoint module + +defoverridable child_spec: 1 + +def child_spec(_arg) do + endpoint_config = [ + http: [...], + https: [...], + ... + ] + + super(endpoint_config) +end +``` + ## 0.5.1 - Support bandit 1.x diff --git a/README.md b/README.md index b4e36fd..c17ff77 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ A basic demo Phoenix project is available [here](https://github.com/sasa1977/sit defp deps do [ # ... - {:site_encrypt, "~> 0.5"} + {:site_encrypt, "~> 0.6"} ] end end diff --git a/mix.exs b/mix.exs index f7484df..a6f2c9c 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule SiteEncrypt.MixProject do use Mix.Project - @version "0.5.1" + @version "0.6.0" def project do [