-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'duffelhq-ua-support-goth-1-3'
Also bumps version to 1.0.0
- Loading branch information
Showing
15 changed files
with
903 additions
and
666 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Upgrading from Kane 0.9 | ||
|
||
Earlier versions of Kane relied on global application environment configuration which is deprecated in favour of a more direct and explicit approach in Kane vX.X+. Kane is following the same principle changes of [Goth 1.3+](https://github.com/peburrows/goth/blob/master/UPGRADE_GUIDE.md). | ||
|
||
Below is a step-by-step upgrade path from Goth 0.x to X.X: | ||
|
||
Upgrade Goth to [1.3+](https://github.com/peburrows/goth/blob/master/UPGRADE_GUIDE.md). Previous versions of Kane, heavily depended on the global configuration of Goth. | ||
|
||
So, your `mix.exs` should be looking like this: | ||
|
||
```elixir | ||
def deps do | ||
[ | ||
{:goth, "~> 1.3"}, | ||
{:kane, "~> X.X"} | ||
] | ||
end | ||
``` | ||
|
||
You might have a code similar to this: | ||
|
||
|
||
```elixir | ||
subscription = %Kane.Subscription{ | ||
name: "my-sub", | ||
topic: %Kane.Topic{ | ||
name: "my-topic" | ||
} | ||
} | ||
|
||
{:ok, messages} = Kane.Subscription.pull(subscription) | ||
``` | ||
|
||
Now you need explicity fetch the token and the project's id: | ||
|
||
```elixir | ||
defmodule MyApp do | ||
def kane do | ||
{:ok, token} = Goth.fetch(MyApp.Goth) | ||
project_id = Application.fetch_env!(:my_app, :gcp_credentials)["project_id"] | ||
|
||
%Kane{ | ||
project_id: project_id, | ||
token: token | ||
} | ||
end | ||
end | ||
|
||
# then | ||
{:ok, messages} = Kane.Subscription.pull(MyApp.kane(), subscription) | ||
``` | ||
|
||
For more information on earlier versions of Kane, [see v0.9.0 documentation on hexdocs.pm](https://hexdocs.pm/kane/0.9.0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
use Mix.Config | ||
|
||
config :goth, | ||
json: "config/dev-credentials.json" |> Path.expand |> File.read! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
use Mix.Config | ||
|
||
config :goth, | ||
json: "config/test-credentials.json" |> Path.expand |> File.read! | ||
|
||
config :kane, :token, Kane.TestToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.