From b918648853c8f18c5e00e94c68e5f135487f9d93 Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Sun, 25 Feb 2024 01:21:09 -0500 Subject: [PATCH 1/7] add a changelog --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0617da0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + + +## [Unreleased] - 2024-02-xx + +### Changed + +- Update from `Mix.Config` to `Config` ([#4](https://github.com/elixir-waffle/waffle_gcs/pull/4)) (Rafael Scheffer, @rschef) +- Bump `google_api_storage` from `0.29` to `0.34` ([#4](https://github.com/elixir-waffle/waffle_gcs/pull/4)) (Rafael Scheffer, @rschef) +- Bump `waffle` from `1.1.5` to `1.1.8` +- Bump `ex_doc` from `0.25` to `0.31` +- Bump `dialyxir` from `1.1.0` to `1.4.3` + +### Added +- + +### Removed + +- **Breaking:** drop support for Elixir versions `< v1.12` + +### Fixed +- + + +## [0.2.0] - 2021-08-20 + +### Changed +- Bump `waffle` from `0.0.3` to `1.1` +- Bump `google_api_storage` from `0.12` to `0.14` +### Added +- Initial support for custom token generation +- Allow custom GCS object headers w/ `gcs_object_headers/2` callback + +--- +#### References +- https://common-changelog.org From 4f58a8108e705cd118075fbd642a20520dc6d4ee Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:16:19 -0400 Subject: [PATCH 2/7] update changelog --- CHANGELOG.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0617da0..69b3425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -## [Unreleased] - 2024-02-xx +## [0.2.1] - 2024-03-25 ### Changed @@ -11,15 +11,18 @@ - Bump `ex_doc` from `0.25` to `0.31` - Bump `dialyxir` from `1.1.0` to `1.4.3` -### Added -- ### Removed -- **Breaking:** drop support for Elixir versions `< v1.12` +- **Breaking:** drop maintenance support for Elixir versions `< v1.12` +- remove `Waffle.Storage.Google.CloudStorage.fullname/3` as it was a wrapper + - Please use `Waffle.Definition.Versioning.resolve_file_name/3` directly instead + ### Fixed -- +- fix `resolve_file_name` being called twice in certain scenarios [#1](https://github.com/elixir-waffle/waffle_gcs/pull/1) + - remove `Waffle.Storage.Google.CloudStorage.fullname/3`. Please use `Waffle.Definition.Versioning.resolve_file_name/3` directly instead + - changes `Waffle.Storage.Google.CloudStorage.path_for/3` to use the `:file_name` key ## [0.2.0] - 2021-08-20 From 3306368f82c4460fbf5d9c2416b5c32b0106bb05 Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:17:06 -0400 Subject: [PATCH 3/7] update docs config --- README.md | 2 ++ mix.exs | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4e8371..24af63a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Waffle GCS +[![Hex.pm Version](https://img.shields.io/hexpm/v/waffle_gcs)](https://hex.pm/packages/waffle_gcs) +[![waffle_gcs documentation](http://img.shields.io/badge/hexdocs-documentation-brightgreen.svg)](https://hexdocs.pm/waffle_gcs) [![Build Status](https://github.com/elixir-waffle/waffle_gcs/actions/workflows/elixir.yml/badge.svg?branch=main)](https://github.com/elixir-waffle/waffle_gcs/actions) Google Cloud Storage for Waffle diff --git a/mix.exs b/mix.exs index 2f8899a..9fbb06e 100644 --- a/mix.exs +++ b/mix.exs @@ -10,6 +10,7 @@ defmodule Waffle.Storage.Google.CloudStorage.MixProject do elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), deps: deps(), + docs: docs(), package: package(), source_url: "https://github.com/elixir-waffle/waffle_gcs", homepage_url: "https://github.com/elixir-waffle/waffle_gcs" @@ -26,9 +27,19 @@ defmodule Waffle.Storage.Google.CloudStorage.MixProject do defp package do [ - files: ~w(config/config.exs lib LICENSE mix.exs README.md), + files: ~w(config/config.exs lib LICENSE mix.exs README.md CHANGELOG.md), licenses: ["Apache-2.0"], - links: %{"GitHub" => "https://github.com/elixir-waffle/waffle_gcs"} + links: %{ + "GitHub" => "https://github.com/elixir-waffle/waffle_gcs", + "CHANGELOG" => "https://github.com/elixir-waffle/waffle_gcs/blob/main/CHANGELOG" + } + ] + end + + defp docs do + [ + main: "readme", + extras: ["README.md", "CHANGELOG.md"] ] end From 0eeb7ded8f5c25f9e2ee226f883d553c6e52ac0c Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:18:15 -0400 Subject: [PATCH 4/7] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24af63a..79627eb 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Goth. config :waffle, storage: Waffle.Storage.Google.CloudStorage, bucket: "gcs-bucket-name", - token_fetcher: Waffle.Storage.Googke.Token.Fetcher.GothTokenFetcher + token_fetcher: Waffle.Storage.Google.Token.GothTokenFetcher ``` ## URL Signing From 37980abcaa1c39876ba5a84530d40f6105fd2ffe Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:57:38 -0400 Subject: [PATCH 5/7] add `UPGRADING.md` --- UPGRADING.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ mix.exs | 2 +- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 UPGRADING.md diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..5df8f0e --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,78 @@ +# Upgrading from v0.2 to v0.3 + +v0.2.0 and prior relied on deprecated functionality in `goth`. + +As of v0.3 a Goth module is required. We suggest following [their documentation](https://hexdocs.pm/goth/1.4.3/readme.html#upgrading-from-goth-1-2) for upgrading for your particular use-case. + +For `waffle_gcs` and the `:token_fetcher` option, that might look something like this: + +```elixir +defmodule MyApp.WaffleTokenFetcher do + @behaviour Waffle.Storage.Google.Token.Fetcher + + @impl true + def get_token(_scope) when is_binary(_scope) do + Goth.fetch!(MyApp.Goth).token + end +end +``` + +And configure `waffle_gcs` to use your module: + +```elixir +config :waffle, + storage: Waffle.Storage.Google.CloudStorage, + bucket: "gcs-bucket-name", + token_fetcher: MyApp.WaffleTokenFetcher +``` + + + +If you don't already have Goth module implementation, and want to be able to configure it per environment, here's an example that reads from the application configuration during startup. + +```elixir +# lib/my_app/goth.ex +defmodule MyApp.Goth + + @spec child_spec(any()) :: Supervisor.child_spec() + def child_spec(_args) do + env_opts = Keyword.new(Application.get_env(:my_app, MyApp.Goth, [])) + opts = Keyword.merge([name: MyApp.Goth], env_opts) + + %{ + :id => MyApp.Goth, + :start => {Goth, :start_link, [opts]} + } + end +end +``` + +```elixir +# config.exs +config :my_app, MyApp.Goth, source: {:metadata, []} + +# config/test.exs +# Optional, for if you need to stub `goth` in test +# requires a custom `:http_client` module/function from the `Goth.start_link/1` documentation. +config :my_app, MyApp.Goth, + source: {:metadata, []}, + http_client: {&MyAppTest.GothHttpClientStub.access_token_response/1, []} +``` + +```elixir +# lib/my_app/application.exs +defmodule MyApp.Application do + use Application +def start(_type, _args) do + children = [ + # ... other things + # The `child_spec/1` handles fetching the proper config + MyApp.Goth + # ... other things + ] + opts = [strategy: :one_for_one, name: MyApp.Supervisor] + Supervisor.start_link(children, opts) +end +``` + +For other `:source` configurations of `MyApp.Goth`, check out the `goth` documentation for [`Goth.start_link/1`](https://hexdocs.pm/goth/Goth.html#start_link/1) diff --git a/mix.exs b/mix.exs index 9fbb06e..6001068 100644 --- a/mix.exs +++ b/mix.exs @@ -39,7 +39,7 @@ defmodule Waffle.Storage.Google.CloudStorage.MixProject do defp docs do [ main: "readme", - extras: ["README.md", "CHANGELOG.md"] + extras: ["README.md", "CHANGELOG.md", "UPGRADING.md"] ] end From 4f2717d66efa5a05cd4e9b0790e3edddf777da3f Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:58:06 -0400 Subject: [PATCH 6/7] update changelog --- CHANGELOG.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b3425..2b01e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,24 @@ # Changelog -## [0.2.1] - 2024-03-25 +## [0.3.0] - 2024-04-xx ### Changed +- Add official support to Goth >= 1.3 ([#2](https://github.com/elixir-waffle/waffle_gcs/pull/2) (Ulisses Almeida, @ulissesalmeida)) - Update from `Mix.Config` to `Config` ([#4](https://github.com/elixir-waffle/waffle_gcs/pull/4)) (Rafael Scheffer, @rschef) +- Bump `jose` from `1.10.1` to `1.11.6` ([#6](https://github.com/elixir-waffle/waffle_gcs/pull/6) (Jim Kane, @fastjames)) - Bump `google_api_storage` from `0.29` to `0.34` ([#4](https://github.com/elixir-waffle/waffle_gcs/pull/4)) (Rafael Scheffer, @rschef) +- Bump `google_api_storage` from `0.34` to `0.37` ([#12](https://github.com/elixir-waffle/waffle_gcs/pull/12)) (dependabot) - Bump `waffle` from `1.1.5` to `1.1.8` -- Bump `ex_doc` from `0.25` to `0.31` +- Bump `ex_doc` from `0.25` to `0.31.2` +- - Bump `dialyxir` from `1.1.0` to `1.4.3` ### Removed -- **Breaking:** drop maintenance support for Elixir versions `< v1.12` +- **Breaking:** drop maintenance support for Elixir versions `< v1.13` - remove `Waffle.Storage.Google.CloudStorage.fullname/3` as it was a wrapper - Please use `Waffle.Definition.Versioning.resolve_file_name/3` directly instead From 2c1f74984bf6044671bc06cb6cb5af8a03209c41 Mon Sep 17 00:00:00 2001 From: Peter Mueller <6015288+petermueller@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:58:18 -0400 Subject: [PATCH 7/7] Bump to 0.3 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 6001068..7756621 100644 --- a/mix.exs +++ b/mix.exs @@ -6,7 +6,7 @@ defmodule Waffle.Storage.Google.CloudStorage.MixProject do app: :waffle_gcs, name: "Waffle GCS", description: description(), - version: "0.2.0", + version: "0.3.0", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), deps: deps(),