Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a changelog #9

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Changelog


## [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.2`
-
- Bump `dialyxir` from `1.1.0` to `1.4.3`


### Removed

- **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


### 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

### 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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -101,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
Expand Down
78 changes: 78 additions & 0 deletions UPGRADING.md
ulissesalmeida marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 14 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ 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(),
docs: docs(),
package: package(),
source_url: "https://github.com/elixir-waffle/waffle_gcs",
homepage_url: "https://github.com/elixir-waffle/waffle_gcs"
Expand All @@ -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", "UPGRADING.md"]
]
end

Expand Down
Loading